Serial syntax

Started by D'Arcy J.M. Cainover 27 years ago4 messageshackers
Jump to latest
#1D'Arcy J.M. Cain
darcy@druid.net

This works.
CREATE TABLE x (a serial, b int);
but this doesn't.
CREATE TABLE x (a serial PRIMARY KEY, b int);

Should it?

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.
#2Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: D'Arcy J.M. Cain (#1)
Re: [HACKERS] Serial syntax

This works.
CREATE TABLE x (a serial, b int);
but this doesn't.
CREATE TABLE x (a serial PRIMARY KEY, b int);
Should it?

Yeah. I'm testing some patches now...

- Tom

#3Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: D'Arcy J.M. Cain (#1)
Re: [HACKERS] Serial syntax

Yeah. I'm testing some patches now...

postgres=> create table t (s serial, ss serial primary key);
NOTICE: CREATE TABLE will create implicit sequence
t_s_key for SERIAL column t.s
NOTICE: CREATE TABLE will create implicit sequence
t_ss_seq for SERIAL column t.ss
NOTICE: CREATE TABLE/UNIQUE will create implicit index
t_s_key for table t
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
t_pkey for table t
CREATE

#4Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: D'Arcy J.M. Cain (#1)
Serial syntax, DEFAULT NULL, and rules

Yeah. I'm testing some patches now...

I've committed patches to the cvs source tree to allow PRIMARY KEY to be
specified with the SERIAL type. The patches also fix some DEFAULT NULL
problems and the "SELECT @1" problem.

With these patches and fixes for the rules regression tests and results
all regression tests pass on my linux-2.0.30/i686 machine.

I've enclosed the source patches _except_ for the regression test
changes, since those involve new files, etc. Also, I have _not_ updated
gram.c yet, so anyone building in the next few days may need bison to
build. If that is a problem someone can go ahead and build and commit a
new gram.c.

I'm out of town tomorrow through Sunday, but keep those cards and
letters coming :)

- Tom

Attachments:

analyze.c.patchtext/plain; charset=us-ascii; name=analyze.c.patchDownload+15-6
gram.y.patchtext/plain; charset=us-ascii; name=gram.y.patchDownload+41-11
parse_oper.c.patchtext/plain; charset=us-ascii; name=parse_oper.c.patchDownload+33-31