Bug #524: Bad quoting of backslash in text arrays

Поиск
Список
Период
Сортировка
Искать

Bug #524: Bad quoting of backslash in text arrays

От:
pgsql-bugs@postgresql.org
Дата:
Ondrej Palkovsky (ondrap@penguin.cz) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Bad quoting of backslash in text arrays

Long Description
I'm using text arrays to store some information. Unfortunately I got some text that contained backslash. The problem is that on output the backslash doesn't get doubled, so if you have the combination 'backslash+dquote', you totally confuse the parsing modules (both PoPy and PyPgSql). 

Sample Code
create table test (
a text[]
);
insert into test values ('{"aaa\\\\bbb\\"ccc"}');
select * from test;
{"aaa\bbb\"ccc"}
Note that the backslash between aaa and bbb should be doubled.

No file was uploaded with this report

Re: Bug #524: Bad quoting of backslash in text arrays

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
pgsql-bugs@postgresql.org writes:
> Note that the backslash between aaa and bbb should be doubled.

Yeah, I think you're right.  I get:

regression=# select a from test;
        a
------------------
 {"aaa\bbb\"ccc"}
(1 row)

regression=# select a[1] from test;
      a
-------------
 aaa\bbb"ccc
(1 row)

If the array output routine is going to backslash the ", methinks it'd
better backslash the backslash too.

Any objections to changing this behavior?

			regards, tom lane
FAQ