Tom Lane wrote:
> > Third, I found out that psql has some unusual handling of escaped
> > numbers. Instead of using \ddd as octal, it has \ddd is decimal, \0ddd
> > is octal, and \0xddd is decimal. It is basically following the strtol()
> > rules for an escaped value. This seems confusing and contradicts how
> > the rest of our system works.
>
> I agree, that's just going to confuse people.
Fixed and applied, with no hex addition.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Index: src/bin/psql/psqlscan.l
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/psqlscan.l,v
retrieving revision 1.10
diff -c -c -r1.10 psqlscan.l
*** src/bin/psql/psqlscan.l 26 May 2005 01:24:29 -0000 1.10
--- src/bin/psql/psqlscan.l 30 May 2005 14:35:43 -0000
***************
*** 849,877 ****
"\\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]* {
/* 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));
}
"\\". { emit(yytext + 1, 1); }
--- 849,858 ----
"\\r" { appendPQExpBufferChar(output_buf, '\r'); }
"\\f" { appendPQExpBufferChar(output_buf, '\f'); }
! "\\"[0-7]{1,3} {
/* octal case */
appendPQExpBufferChar(output_buf,
! (char) strtol(yytext + 1, NULL, 8));
}
"\\". { emit(yytext + 1, 1); }