From: | Neil Conway <nconway(at)klamath(dot)dyndns(dot)org> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Re: last comma inside "CREATE TABLE ()" statements |
Date: | 2001-04-22 20:15:24 |
Message-ID: | 20010422161524.A259@klamath.dyndns.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sun, Apr 22, 2001 at 02:48:36PM -0400, Mitch Vincent wrote:
> > 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?
>
> I agree -- while it would be a huge problem, it's a matter of following
> the rules.. I don't see any reason why we can't expect users to follow the
> proper syntax rules.. I missed the first post so I don't know how the person
> who posted this was actually putting the comma there -- perhaps there was a
> good reason for it..
I've run into this several times, and I agree with those who'd like to see
this added. When creating/editing a schema, I usually use this format:
CREATE TABLE t1 (
foo TEXT,
bar TEXT
);
Now let's say I wanted to add another column:
CREATE TABLE t2 (
foo TEXT,
bar TEXT,
baz TEXT
);
I would need to edit 2 lines (to add the trailing comma, and then the
next line). The same applies when deleting the last column in a table.
It would be easier, IMHO, to allow this:
CREATE TABLE t1 (
foo TEXT,
bar TEXT,
);
So that you can easily add or delete columns without needing to worry
about commas.
As for following standards, I think we should aim to provide the best
RDBMS possible. Being SQL-compliant is valuable, so we should do that.
But in areas where we can extend the standard, or break it in a minor
way a for major gain, I think the benefits outweigh the costs.
And really, how many errors is this going to prevent? AFAICT, it would
only catch the case where you've deleted the last column in a table
accidentally -- it won't catch mistakes anywhere else. This doesn't
seem to be very useful.
Of course, that's just my opinion. I might be wrong ;-)
Cheers,
Neil
--
Neil Conway <neilconway(at)home(dot)com>
Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc
Encrypted mail welcomed
Violence is to dictatorship as propaganda is to democracy.
-- Noam Chomsky
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Perdue | 2001-04-22 20:15:40 | Re: Sourceforge PG crash |
Previous Message | Tom Lane | 2001-04-22 20:11:59 | Re: Re: Getting milliseconds out of TIMESTAMP |