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

From Tom Lane
Subject Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields strange
Date
Msg-id 26224.1091853468@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields  (Joe Conway <mail@joeconway.com>)
Responses Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Joe Conway <mail@joeconway.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


pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields
Next
From: Joe Conway
Date:
Subject: Re: [PATCHES] [BUGS] casting strings to multidimensional arrays yields