Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields - Mailing list pgsql-hackers

From Joe Conway
Subject Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields
Date
Msg-id 4112C895.4090904@joeconway.com
Whole thread Raw
In response to Re: [BUGS] casting strings to multidimensional arrays yields strange results  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields strange  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Joe Conway wrote:
> I'm hesitant to apply the attached this late before the beta without 
> review, but it seems to take care of the pathological cases I came up 
> with, doesn't break anything AFAICS, and passes all regression tests. I 
> guess it can go into beta 2.

I've continued to hack on array literal parsing today, and in doing so 
came up with a question regarding behavior. Currently the following works:

regression=# select '{0 second,0 second}'::interval[];      interval
--------------------- {00:00:00,00:00:00}
(1 row)

However, since we don't require an element with embedded spaces to be 
quoted, it also means that whitespace just before the delimiter is 
significant (even though leading whitespace is not) because there is no 
way to know when the element is complete:

regression=# select '{   0 second   ,0 second}'::text[];            text
---------------------------- {"0 second   ","0 second"}
(1 row)


I view the current behavior as a bug. While making changes, I'd like to 
require elements with embedded whitespace to be quoted so that the above 
does this:

regression=# select '{0 second,0 second}'::text[];
ERROR:  malformed array literal: "{0 second,0 second}"

Additionally I'd like to make whitespace before and after quoted or 
unquoted elements insignificant. Any comments?

Thanks,

Joe


pgsql-hackers by date:

Previous
From: "Hicham G. Elmongui"
Date:
Subject: OidFunctionCall4
Next
From: Tom Lane
Date:
Subject: 8.0 beta status