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

Поиск
Список
Период
Сортировка
От will trillich
Тема Re: last comma inside "CREATE TABLE ()" statements
Дата
Msg-id 20010426091241.B12147@serensoft.com
обсуждение исходный текст
Ответ на Re: last comma inside "CREATE TABLE ()" statements  (Mike Finn <mike.finn@tacticalExecutive.com>)
Список pgsql-general
the original request was to allow extra commas such as perl does
-- for example:

    create table xyz (
        f1 int4,
        t1 text,
    --    v1 varchar(25),
        s1 serial,  -- note extra trailing comma
    );
    select
        v.fld1,
    --    t.fld2,
        v.fldN, -- extra comma
    from
        tbl1 t,
        view1 v, -- extra comma
    where
        ...

PLUSSES:

1    it's easier to cut & paste whole lines

2    it's easier to comment out any line

3    allows quicker munging of source code, saving precious
    programmer time (big, Big, BIG plus, in the long run)

MINUSES:

1    requires some tweaks to postgres source code

2    nonstandard -- rubs philosophical purists the wrong way

3    increases iterations through code as extra commas are added
    or removed (when lines of sql code are moved around), eating
    up programmer time

IMHO:

let the purists code strict ISO if they like; we're not
recommending that the current paradigm be CHANGED to allow extra
commas, only that a new one be ADDED to allow extra commas.

regarding nonstandard -- we wouldn't ditch "create rule" or
"inherits" just because the standards folk haven't learned to
appreciate them yet, would we?

i've secretly wanted this feature for months and months, but i
didn't have the globs to ask for it. :)

can we vote? (no florida jokes, please...)

--

note:

in "CREATE TABLE" you can specify a primary key at the end of
your field defs, to accomplish just about the same effect:

    create table thisway (
        code char(6),
        name varchar(20),
        amt float8,
        other int4, -- pseudo extra comma

        PRIMARY KEY( code )
    );

of course, this approach works only for table creation.

--
don't visit this page. it's bad for you. take my expert word for it.
http://www.salon.com/people/col/pagl/2001/03/21/spring/index1.html

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

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

Предыдущее
От: caldodge@fpcc.net
Дата:
Сообщение: Re: CREATE TABLE AS... syntax?
Следующее
От: will trillich
Дата:
Сообщение: crypt(table.field) ?