Re: Trailing comma support in SELECT statements

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-21 00:57:00
Message-ID: 5445AF5C.7090302@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/20/14, 11:16 AM, Andrew Dunstan wrote:
> On 10/20/2014 11:59 AM, David E. Wheeler wrote:
>> On Oct 18, 2014, at 7:06 PM, Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> wrote:
>>
>>> Yes.
>>>
>>> The only case I can think of where we wouldn't want this is COPY.
>>>
>>> BTW, this should also apply to delimiters other than commas; for example, some geometry types use ; as a delimiter between points.
>> I don’t think it should apply to the internals of types, necessarily. JSON, for example, always dies on an trailing comma, so should probably stay that way. Well, maybe allow it on JSONB input, but not JSON. Though we perhaps don’t want their behaviors to diverge.
>>
>
>
> The JSON spec is quite clear on this. Leading and trailing commas are not allowed. I would fight tooth and nail not to allow it for json (and by implication jsonb, since they use literally the same parser - in fact we do that precisely so their input grammars can't diverge).

+1. Data types that implement specs should follow the spec.

I was more concerned about things like polygon, but the real point (ha!) is that we need to think about the data types too. (I will say I don't think things that mandate an exact number of elements (like point, box, etc) should support extra delimiters).
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G Johnston 2014-10-21 01:18:38 Re: Questions on domain on composite / casts ignoring domains
Previous Message Wim Lewis 2014-10-21 00:53:11 Re: Patch: Add launchd Support