Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields

From: Joe Conway <mail(at)joeconway(dot)com>
To: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kris Jurka <books(at)ejurka(dot)com>
Subject: Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields
Date: 2004-08-05 23:53:57
Message-ID: 4112C895.4090904@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-patches

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-08-06 00:00:26 Re: BUG #1206: sig fault 12 and core dumps using conflux
Previous Message PostgreSQL Bugs List 2004-08-05 19:04:10 BUG #1206: sig fault 12 and core dumps using conflux

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-08-05 23:58:14 8.0 beta status
Previous Message Hicham G. Elmongui 2004-08-05 23:43:04 OidFunctionCall4

Browse pgsql-patches by date

  From Date Subject
Next Message Matthew T. O'Connor 2004-08-06 00:06:33 Re: Autovacuum Integration Patch Take 5
Previous Message Tom Lane 2004-08-05 23:42:13 Re: Autovacuum Integration Patch Take 5