Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf13c132

Browse files
committed
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 butdidn'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.
1 parent6616e23 commitf13c132

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

‎src/bin/psql/psqlscan.l

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* Portions Copyright (c) 1994, Regents of the University of California
3434
*
3535
* IDENTIFICATION
36-
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.10 2005/05/26 01:24:29 tgl Exp $
36+
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.11 2005/05/30 14:50:35 momjian Exp $
3737
*
3838
*-------------------------------------------------------------------------
3939
*/
@@ -849,29 +849,10 @@ other.
849849
"\\r"{appendPQExpBufferChar(output_buf,'\r'); }
850850
"\\f"{appendPQExpBufferChar(output_buf,'\f'); }
851851

852-
"\\"[1-9][0-9]*{
853-
/* decimal case */
854-
appendPQExpBufferChar(output_buf,
855-
(char)strtol(yytext +1,NULL,0));
856-
}
857-
858-
"\\"0[0-7]*{
852+
"\\"[0-7]{1,3}{
859853
/* octal case */
860854
appendPQExpBufferChar(output_buf,
861-
(char)strtol(yytext +1,NULL,0));
862-
}
863-
864-
"\\"0[xX][0-9A-Fa-f]+{
865-
/* hex case */
866-
appendPQExpBufferChar(output_buf,
867-
(char)strtol(yytext +1,NULL,0));
868-
}
869-
870-
"\\"0[xX]{
871-
/* failed hex case */
872-
yyless(2);
873-
appendPQExpBufferChar(output_buf,
874-
(char)strtol(yytext +1,NULL,0));
855+
(char)strtol(yytext +1,NULL,8));
875856
}
876857

877858
"\\".{emit(yytext +1,1); }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp