Re: array_to_string bug? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: array_to_string bug?
Date
Msg-id 14471.1258051602@sss.pgh.pa.us
Whole thread Raw
In response to Re: array_to_string bug?  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, Nov 12, 2009 at 1:28 PM, Steve Crawford
> <scrawford@pinpointresearch.com> wrote:
>> Although it might cause a fair amount of backward-compatibility trouble, the
>> string representation could either use NULL to represent a null element as
>> is allowed in other contexts or require that empty-string elements be
>> represented as "" to differentiate ,"", (empty-string element) from ,, (null
>> element).

> That would cause a substantial amount of grief to people who might not
> want that behavior, though.  I use these functions for creating
> human-readable output, not for serialization.  Simple, predictable
> behavior is very important.

I agree --- we don't want to start introducing quoting rules into
array_to_string.  I think the viable alternatives are the current
behavior, or treating a NULL element as if it were an empty string.
David's idea that the entire output should go to NULL might be sane
from a strict semantics point of view, but it also seems to make the
function just about entirely useless in practice.
        regards, tom lane


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: array_to_string bug?
Next
From: Jeff Davis
Date:
Subject: Re: next CommitFest