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

From Peter Eisentraut
Subject Re: [SQL] INSERT w/o variable names for a SERIAL type?
Date
Msg-id Pine.LNX.4.21.0002260418130.3063-100000@localhost.localdomain
Whole thread Raw
In response to INSERT w/o variable names for a SERIAL type?  ("Emils Klotins" <emils@mail.usis.bkc.lv>)
Responses Re: [SQL] INSERT w/o variable names for a SERIAL type?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [SQL] INSERT w/o variable names for a SERIAL type?  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-sql
Emils Klotins writes:

> Now, if I want to write a general #define, I'd need to have a way 
> to specify 'default' for SERIAL field, for, if I omit the id field in 
> VALUES, I need to specify all the rest of the fields explicitly. 
> 
> Is there any value I could put in place of id in VALUES part, to 
> make it replaced with the next value in sequence?

INSERT INTO my_table VALUES (a, b, c, DEFAULT, x, y, z, ...);

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] Default sequence values
Next
From: Tom Lane
Date:
Subject: Re: [SQL] INSERT w/o variable names for a SERIAL type?