diff options
author | Bruce Momjian <bruce@momjian.us> | 2005-05-30 14:50:35 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2005-05-30 14:50:35 +0000 |
commit | f13c132072fe39ecbabf662c440216d9ef74c9c4 (patch) | |
tree | 075e75bb14c05717f229b7d314e3516963918de8 | |
parent | 6616e23264a6da446c6c28aa46a54f61297cd729 (diff) |
Have psql escape bytes in strings for variables follow the backend
conventions of only allowing octal, like \045. Remove support for
\decimal, \0octal, and \0xhex which matches the strtol() function but
didn't make sense with backslashes.
These now return the same character:
test=> \set x '\54'
test=> \echo :x
,
test=> \set x '\054'
test=> \echo :x
,
THIS IS A BACKWARD COMPATIBILITY CHANGE.
-rw-r--r-- | src/bin/psql/psqlscan.l | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/bin/psql/psqlscan.l b/src/bin/psql/psqlscan.l index 88763d504bc..2fd4d729a3a 100644 --- a/src/bin/psql/psqlscan.l +++ b/src/bin/psql/psqlscan.l @@ -33,7 +33,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.10 2005/05/26 01:24:29 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.11 2005/05/30 14:50:35 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -849,29 +849,10 @@ other . "\\r" { appendPQExpBufferChar(output_buf, '\r'); } "\\f" { appendPQExpBufferChar(output_buf, '\f'); } -"\\"[1-9][0-9]* { - /* decimal case */ - appendPQExpBufferChar(output_buf, - (char) strtol(yytext + 1, NULL, 0)); - } - -"\\"0[0-7]* { +"\\"[0-7]{1,3} { /* octal case */ appendPQExpBufferChar(output_buf, - (char) strtol(yytext + 1, NULL, 0)); - } - -"\\"0[xX][0-9A-Fa-f]+ { - /* hex case */ - appendPQExpBufferChar(output_buf, - (char) strtol(yytext + 1, NULL, 0)); - } - -"\\"0[xX] { - /* failed hex case */ - yyless(2); - appendPQExpBufferChar(output_buf, - (char) strtol(yytext + 1, NULL, 0)); + (char) strtol(yytext + 1, NULL, 8)); } "\\". { emit(yytext + 1, 1); } |