Re: last comma inside "CREATE TABLE ()" statements - Mailing list pgsql-general

From Louis-David Mitterrand
Subject Re: last comma inside "CREATE TABLE ()" statements
Date
Msg-id 20010423090647.D1120@apartia.ch
Whole thread Raw
In response to Re: last comma inside "CREATE TABLE ()" statements  ("Oliver Elphick" <olly@lfix.co.uk>)
List pgsql-general
On Sun, Apr 22, 2001 at 07:44:46PM +0100, Oliver Elphick wrote:
> Tom Lane wrote:
>   >Louis-David Mitterrand <vindex@apartia.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 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?

After giving it a thought, this seems like a reasonable objection. My
comparison with perl (a trailing comma is accepted in list definitions)
isn't entirely valid as perl is a programming language (doh) in which
most time is spent editing.

On the other hand, building a DB schema more planning and reflexion
(hopefully) and less editing. Removing a trailing comma isn't going to
give increase anybody's carpal tunnel syndrome.

[crawls back into hole]

> --
> Oliver Elphick                                Oliver.Elphick@lfix.co.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

--
Religion is something left over from the infancy of our intelligence; it
will fade away as we adopt reason and science as our guidelines.
-- Bertrand Russell

pgsql-general by date:

Previous
From: "Dan Wilson"
Date:
Subject: phpPgAdmin 2.3 Released [security bug fix]
Next
From: "Oliver Elphick"
Date:
Subject: Re: max. size for a table