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

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

Joe Conway <mail(at)joeconway(dot)com> writes:
> Tom Lane wrote:
>> [ random griping ]

> Well, '{}' is a special case representing an empty array.

Hmm ... good point ... it is not obvious whether that is an empty array
(0x0) or a 1x1 array containing a single zero-length string. I guess
if we want to make both these possibilities representable, we ought to
stipulate that '{}' means the first and '{""}' means the second.

> In my mind, '{{},{}}' clearly defines a two dimensional array, and
> therefore needs elements, which in this case would have to be NULL (or
> empty strings -- see below). Once we can deal with NULL elements, I'd
> think '{{},{}}' ought to be accepted, and produce a 2d array with 2 NULL
> elements. Note how this works in 7.4:

Urgh ... that makes for a third case to support. How will you represent
0x0 vs 1x1 empty string vs 1x1 NULL?

> I thought creation of empty strings was what we agreed the other day to
> eliminate?

I'm not sure that we had such an agreement, but in any case we've got
to understand how to distinguish empty-string from NULL.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PostgreSQL Bugs List 2004-08-07 08:42:22 BUG #1207: retrieve error
Previous Message Joe Conway 2004-08-07 03:52:21 Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-08-07 05:06:30 Re: UNICODE characters above 0x10000
Previous Message Tom Lane 2004-08-07 04:07:31 Re: PITR - recovery to a particular transaction

Browse pgsql-patches by date

  From Date Subject
Next Message Gavin Sherry 2004-08-07 05:03:31 Re: Minor BEFORE DELETE trigger fix
Previous Message Joe Conway 2004-08-07 03:52:21 Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields