Re: last comma inside "CREATE TABLE ()" statements

From: GH <grasshacker(at)over-yonder(dot)net>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Louis-David Mitterrand <vindex(at)apartia(dot)ch>, pgsql-general(at)postgresql(dot)org
Subject: Re: last comma inside "CREATE TABLE ()" statements
Date: 2001-04-22 19:16:02
Message-ID: 20010422141602.A81180@over-yonder.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Apr 22, 2001 at 07:44:46PM +0100, some SMTP stream spewed forth:
> Tom Lane wrote:
> >Louis-David Mitterrand <vindex(at)apartia(dot)ch> writes:
> >> Is it against the SQL standard to accept a trailing comma in a table
> >> declaration?
> >
> >Yes ...
> >
> >> CREATE TABLE "currency" (
> >> currency_id varchar(3),
> >> rate float, <-------------------- BOOM! parse error
> >> );
> >
> >> As in perl, it would make life easier to simply ignore/accept a trailing
> >> comma on table declarations.
> >
> >... however, this seems like a reasonable idea that would not introduce
> >any major problems. I have no objections, if someone wants to submit
> >a grammar patch.

I can think of no place where this would be even remotely useful.
Is it really that difficult to remove a comma?
If it works now for *all* users of PostgreSQL, why should we change it?

gh

>
> I suppose it isn't a major problem, but enforcing strict grammar
> helps to show up inadvertent errors. Suppose I have a set of schema
> building files for a whole system; the way I do things, there may be fifty
> or more files, one per table. If one of these gets corrupted in editing
> (perhaps a line gets deleted by mistake) it would be nice to know about it
> through a parser error. Of course, an error may be such that the parser
> won't detect it, but why remove protection by gratuitously departing from
> the standard?
>
> --
> Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
> Isle of Wight http://www.lfix.co.uk/oliver
> PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
> GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
> ========================================
> "If my people, which are called by my name, shall
> humble themselves, and pray, and seek my face, and
> turn from their wicked ways; then will I hear from
> heaven, and will forgive their sin, and will heal
> their land." II Chronicles 7:14
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-04-22 19:37:12 Re: bind postmaster to address
Previous Message Peter Pilsl 2001-04-22 19:08:35 bind postmaster to address