From: Brook Milligan <brook@trillium.NMSU.Edu>
To: lockhart@alumni.caltech.edu
Cc: maillist@candle.pha.pa.us
Cc: hackers@postgreSQL.org
Subject: Re: [HACKERS] Open 6.4 items
Date: Mon, 24 Aug 1998 10:04:36 -0600 (MDT)
Message-ID: <199808241604.KAA08726@trillium.nmsu.edu> (raw)
In-Reply-To: <35E1867F.96B11C7B@alumni.caltech.edu>
References: <199808240208.WAA09755@candle.pha.pa.us>
<35E1867F.96B11C7B@alumni.caltech.edu>
> SERIAL type auto-creates sequence
I won't have time to do this for v6.4. It's not quite the same as the
PRIMARY KEY parser solution, since the sequence must be created _before_
the main portion of the CREATE TABLE command is executed, rather than
after. We should go through the high-level parser routines and allow all
of them to return multiple parse trees; at the moment I've got a
special-case workaround implemented for the PRIMARY KEY code which
doesn't generalize very well.
Actually, sequences can be defined _either_ before or after the
table. See below.
Cheers,
Brook
===========================================================================
-- create id sequence before table
drop sequence id_sequence_before;
create sequence id_sequence_before start 1;
-- create table
drop table id_table;
create table id_table
(
id_before int4 default nextval ('id_sequence_before'),
id_after int4 default nextval ('id_sequence_after'),
name text
);
-- create id sequence after table
drop sequence id_sequence_after;
create sequence id_sequence_after start 1;
-- populate table
insert into id_table (name) values ('one');
insert into id_table (name) values ('two');
insert into id_table (name) values ('three');
select * from id_table;
===========================================================================
id_before|id_after|name
---------+--------+-----
1| 1|one
2| 2|two
3| 3|three
(3 rows)
===========================================================================
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: brook@trillium.NMSU.Edu, lockhart@alumni.caltech.edu, maillist@candle.pha.pa.us, hackers@postgreSQL.org
Subject: Re: [HACKERS] Open 6.4 items
In-Reply-To: <199808241604.KAA08726@trillium.nmsu.edu>
* 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