On Tue, 2003-03-04 at 19:14, Tom Lane wrote:
> Rod Taylor <[EMAIL PROTECTED]> 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.



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.

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

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to