Re: Re: last comma inside "CREATE TABLE ()" statements
От | Neil Conway |
---|---|
Тема | Re: Re: last comma inside "CREATE TABLE ()" statements |
Дата | |
Msg-id | 20010422161524.A259@klamath.dyndns.org обсуждение исходный текст |
Ответ на | Re: last comma inside "CREATE TABLE ()" statements ("Mitch Vincent" <mitch@venux.net>) |
Список | 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@home.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
В списке pgsql-general по дате отправления: