Commits

Daniele Varrazzo committed cd56f17

Handle PostgreSQL escaped strings

Comments (0)

Files changed (2)

pygments/lexers/postgres.py

             (r'([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?', Number.Float),
             (r'[0-9]+', Number.Integer),
             # TODO: Backslash escapes?
-            (r"'(''|[^'])*'", String.Single),
+            (r"E?'(''|[^'])*'", String.Single),
             (r'"(""|[^"])*"', String.Name), # quoted identifier
             (r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
 

tests/examplefiles/psql_session.txt

  x
 (1 row)
 
+regression=# select E'\x';
+
 piro=> \set foo 30;
 piro=> select * from test where foo <= :foo;
  foo | bar