Skip site navigation (1) Skip section navigation (2)

Re: [PATCHES] ALTER SEQUENCE

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>,Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] ALTER SEQUENCE
Date: 2003-03-05 04:22:07
Message-ID: 1046837902.17609.63.camel@jester (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackerspgsql-patches
On Tue, 2003-03-04 at 19:14, Tom Lane wrote:
> Rod Taylor <rbt(at)rbt(dot)ca> writes:
> > Might get somewhere by making a special domain thats marked as being
> > serial, and using that in the column.
> 
> I recall some discussion last year about making serial et al. into
> domains over int4 and int8, rather than their current utter-hack
> implementation.  Can't recall if we found a problem with the idea,
> or no one got around to doing it, or it just didn't seem to clean
> things up enough to be worth the trouble.  (AFAICS you'd still need
> special-case code to set up the appropriate default expression for
> each column; the domain constraint mechanism wouldn't handle that
> for you.)

Slightly different thought.  I had actually submitted a patch for the
above, but would have to dig through the archives to determine what the
problem was.

CREATE TABLE tab (column SERIAL);

Generates:

table(column serial_table_column)

domain serial_table_column 
  as int4 default nextval("serial_table_column")

Sequence serial_table_column.


Now, rather than having knowedge of the contents of nextval, we simply
trace the dependencies of the column through the domain to the sequence
-- since these will be known to exist.

Thus the below command could function fairly easily on serials:

ALTER SEQUENCE ON table(column)



The alternative is to simply implement the proposed 200N sequence
generator spec, which includes 'NEXT VALUE FOR <sequence>'.

With that in place, our default would then depend on the sequence, and
the ALTER SEQUENCE ON table(column) would function.
-- 
Rod Taylor <rbt(at)rbt(dot)ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

In response to

pgsql-hackers by date

Next:From: Marc G. FournierDate: 2003-03-05 06:00:47
Subject: test to be ignored ...
Previous:From: Tom LaneDate: 2003-03-05 04:04:03
Subject: Re: Error codes revisited

pgsql-patches by date

Next:From: Bruce MomjianDate: 2003-03-05 15:36:06
Subject: Re: [PATCHES] Non-colliding auto generated names
Previous:From: Tom LaneDate: 2003-03-05 00:14:23
Subject: Re: [PATCHES] ALTER SEQUENCE

pgsql-general by date

Next:From: Jeff DavisDate: 2003-03-05 05:18:36
Subject: Re: Why PostgreSQL?
Previous:From: Tom LaneDate: 2003-03-05 04:07:32
Subject: Re: Help with select into

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group