title: psycopg2 replace '%5C' with '\' backslash
body: <p>I tried to decode the URLs in AWS Redshift. When I ran the following code on SQL Workbench, it was totally fine. However, when I use the same code via psycopg2, it gave me the error message <code>ProgrammingError: syntax error at or near "D" LINE 35: ,'%5D',']')) as ...</code></p>
  
  <p>code:</p>
  
  <pre><code>SELECT *,
  REPLACE(LEFT(CONCAT(SUBSTRING(REGEXP_SUBSTR(t1.url, 'keywords=([a-zA-Z0-9]+[%+])*[a-zA-Z0-9]*') from 10), t1.extracted_search_value), 100),'%5C','\\') as parsed_search from new_table t1 
  LIMIT 10
  </code></pre>