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

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: last comma inside "CREATE TABLE ()" statements
Дата
Msg-id 200104221844.f3MIilU22323@linda.lfix.co.uk
обсуждение исходный текст
Ответ на Re: last comma inside "CREATE TABLE ()" statements  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: last comma inside "CREATE TABLE ()" statements  (GH <grasshacker@over-yonder.net>)
Re: last comma inside "CREATE TABLE ()" statements  (Louis-David Mitterrand <vindex@apartia.ch>)
Список pgsql-general
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?

--
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



В списке pgsql-general по дате отправления:

Предыдущее
От: Joel Burton
Дата:
Сообщение: Re: CAST doesn't work :-(
Следующее
От: Peter Pilsl
Дата:
Сообщение: bind postmaster to address