Re: [PATCHES] ALTER SEQUENCE - Mailing list pgsql-hackers

From Rod Taylor
Subject Re: [PATCHES] ALTER SEQUENCE
Date
Msg-id 1046837902.17609.63.camel@jester
Whole thread Raw
In response to Re: [PATCHES] ALTER SEQUENCE  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, 2003-03-04 at 19:14, Tom Lane wrote:
> Rod Taylor <rbt@rbt.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@rbt.ca>

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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCHES] ALTER SEQUENCE
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Best setup for RAM drive