From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Problem with do_quote_ident() |
Date: | 2002-03-27 20:54:39 |
Message-ID: | 200203272054.g2RKsdM22367@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I see in quote.c::do_quote_ident():
*cp2++ = '"';
while (len-- > 0)
{
if (*cp1 == '"')
*cp2++ = '"';
if (*cp1 == '\\')
*cp2++ = '\\';
*cp2++ = *cp1++;
}
*cp2++ = '"';
I am confused by the backslash handling. In my tests, a backslash in a
double-quoted string does not require two backslashes:
test=> create user "a\d";
CREATE USER
test=> select usename, length(usename) from pg_user;
usename | length
----------+--------
a\d | 3
This is because a double-quote in a double-quoted string is entered as
"", not \".
Is it adding another backslash because it assumes the result will appear
in another quoted string?
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2002-03-27 21:18:38 | Re: Problem with do_quote_ident() |
Previous Message | Thomas Sandford | 2002-03-27 20:31:51 | Can't edit tables with timestamps |