Обсуждение: ...

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

...

От
"Billy G. Allie"
Дата:
I have a question about the behavior of the array input routine.  How should
the input string, '{abc"def,defghi",jklmnop}' be parsed?  I would think it
should produce '{"abc\"def","defghi\"","jklmnop"}', but it currently (as of
7.3) produces '{"abcdef,defghi","jklmnop"}'.

Which should be the correct behavior?

Shouldn't a quoted string begin with a double qoute?

--
____       | Billy G. Allie    | Domain....: Bill.Allie@mug.org
|  /|      | 7436 Hartwell     | MSN.......: B_G_Allie@email.msn.com
|-/-|----- | Dearborn, MI 48126|
|/  |LLIE  | (313) 582-1540    |



Вложения

Re:

От
Tom Lane
Дата:
"Billy G. Allie" <Bill.Allie@mug.org> writes:
> I have a question about the behavior of the array input routine.  How should
> the input string, '{abc"def,defghi",jklmnop}' be parsed?  I would think it
> should produce '{"abc\"def","defghi\"","jklmnop"}', but it currently (as of
> 7.3) produces '{"abcdef,defghi","jklmnop"}'.

As did 7.2.  Previous releases (at least back to 7.0, the oldest I have
handy to test) did this:

regression=# select '{abc"def,defghi",jklmnop}'::text[];
         ?column?
--------------------------
 {"def,defghi","jklmnop"}
(1 row)

which is certainly pretty bogus, but it established the precedent that a
double-quoted string could be a substring of an array element, and more
specifically that double-quote didn't stop being special just because it
wasn't the first character of the element string.

> Which should be the correct behavior?

I can't see any strong argument in favor of your proposed change.  I can
tell you that we will get beat up about it if we change anything in this
line --- so you'd better muster a pretty strong argument.

            regards, tom lane