pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: Emils Klotins <emils@mail.usis.bkc.lv>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] INSERT w/o variable names for a SERIAL type?
Date: Sun, 27 Feb 2000 13:58:43 -0500 (EST)
Message-ID: <200002271858.NAA00857@candle.pha.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.21.0002260418130.3063-100000@localhost.localdomain>

[Charset ISO-8859-1 unsupported, filtering to ASCII...]
> 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, ...);

I didn't think that worked, and it doesn't seem to work.  Should it?

	test=> create table j(x serial, y char(10))\g
	NOTICE:  CREATE TABLE will create implicit sequence 'j_x_seq' for SERIAL
	column 'j.x'
	NOTICE:  CREATE TABLE/UNIQUE will create implicit index 'j_x_key' for
	table 'j'
	CREATE
	test=> insert into j values (default,'yes');
	ERROR:  parser: parse error at or near "default"

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (10+ messages)  latest in thread

Message-ID: <200002271858.NAA00857@candle.pha.pa.us>
Permalink:  ../200002271858.NAA00857@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200002271858.NAA00857@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: pgman@candle.pha.pa.us, peter_e@gmx.net, emils@mail.usis.bkc.lv
  Subject: Re: [SQL] INSERT w/o variable names for a SERIAL type?
  In-Reply-To: <200002271858.NAA00857@candle.pha.pa.us>
  References: <Pine.LNX.4.21.0002260418130.3063-100000@localhost.localdomain> <200002271858.NAA00857@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox