Обсуждение: no quotes in arrays in 7.2
I upgraded to pg 7.2.
When I do a SELECT on a column defined as text[ ] I get:
{{FLTL,DFBV2bI16nfqCEag,1000}}
when I do the same SELECT on postgres 7.1 I get the same result but with
quotes:
{{"FLTL","DFBV2bI16nfqCEag","1000"}}
Only using a comma as a separator is not very good, because the text in the
array can contain commas, so seperating can get impossible.
Is the new output a bug?
Peter
--
Bezirksfinanzdirektion Muenchen
Vermessungsabteilung
...............................................................................................
Peter Keller : Tel: (+49) 089-2190-2594
Alexandrastr. 4 : Fax: (+49) 089-2190-2459
(Liebigbau) : mailto:Peter.Keller@bvv.bayern.de
80538 Muenchen : web: http://www.bayern.de/vermessung
On Wed, 20 Mar 2002, Peter Keller wrote:
> I upgraded to pg 7.2.
> When I do a SELECT on a column defined as text[ ] I get:
>
> {{FLTL,DFBV2bI16nfqCEag,1000}}
>
> when I do the same SELECT on postgres 7.1 I get the same result but with
> quotes:
>
> {{"FLTL","DFBV2bI16nfqCEag","1000"}}
>
> Only using a comma as a separator is not very good, because the text in the
> array can contain commas, so seperating can get impossible.
If the string contained a comma it should get quotes put around it on
output:
sszabo=# create table aat(a text[]);
insert into aCREATE
sszabo=# insert into aat values ('{"aaa", "fdadfa,fdad", "3"}');
INSERT 148041 1
sszabo=# select * from aat;
a
-----------------------
{aaa,"fdadfa,fdad",3}
(1 row)
> Is the new output a bug?
Maybe (see recent discussion on the topic)
Peter Keller <peter.keller@bvv.bayern.de> writes:
> Only using a comma as a separator is not very good, because the text in the
> array can contain commas, so seperating can get impossible.
If there are any commas then the value will be quoted.
> Is the new output a bug?
I don't think so. The point was to avoid quoting numeric elements while
fixing the extremely broken rule that array_out used to use to decide
whether to quote or not. The new rule is to look at the text to decide
if it needs any quotes.
regards, tom lane