Re: [SQL] INSERT w/o variable names for a SERIAL type? - Mailing list pgsql-sql

From Ross J. Reedstrom
Subject Re: [SQL] INSERT w/o variable names for a SERIAL type?
Date
Msg-id 20000227134402.A5030@rice.edu
Whole thread Raw
In response to Re: [SQL] INSERT w/o variable names for a SERIAL type?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [SQL] INSERT w/o variable names for a SERIAL type?  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-sql
On Sun, Feb 27, 2000 at 02:04:42PM -0500, Bruce Momjian wrote:
> > > INSERT INTO my_table VALUES (a, b, c, DEFAULT, x, y, z, ...);
> > 
> > I think that is legal SQL92 syntax, but Postgres doesn't accept it
> > at present.
> > 
> 
> The problem is when you are inserting >50 columns, it is a pain.  The
> use of DEFAULT would also allow SERIAL columns to get the proper
> nextval(), rather than having specify the nextval() call specifically.

This, I think, is the best reason for doing it: even if you call
out the column names, as Tom rightly mentions is best, using DEFAULT
allows writing INSERTs without depending on the details of how SERIAL
is implemented in pgsql: i.e. knowing the algorithm for constructing
the sequenec name.

> 
> Added to TODO.


Perhaps we should note which items on the TODO list are needed for what
level of SQL92 compliance. This one, for example, is not necessary for
ENTRY level, but required at INTERMEDIATE. Not that that should stop
anyone from implementing it:  SQL92 Entry is a surprisingly limited
subset, and we have a lot of INTERMEDIATE and FULL features, already.

Ross
-- 
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005



pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [SQL] INSERT w/o variable names for a SERIAL type?
Next
From: maillist@remo.demon.co.uk
Date:
Subject: Rule (which multiple actions) problem with history table.....