Re: Sequence functions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Sequence functions
Date
Msg-id 3425.1053837278@sss.pgh.pa.us
Whole thread Raw
In response to Sequence functions  (Rod Taylor <rbt@rbt.ca>)
Responses Re: Sequence functions
List pgsql-hackers
Rod Taylor <rbt@rbt.ca> writes:
> We need to track sequence usage in things like defaults.  nextval()
> function calls don't easily allow this to happen.

Yeah.  The Oracle syntax is seqname.nextval(); AFAIK our syntax
nextval('seqname') was a quick-and-dirty approximation to that.

> The 200N spec has NEXT VALUE FOR <seqname> as the equivalent to
> nextval(), which would allow this to happen.

Urgh.  These people still think they're writing Cobol, don't they?
Reserved Words 'R Us.  This is one of the few places where I like
Oracle's syntax better than the spec's.

I have looked at implementing Oracle's syntax, and it's almost doable
--- the problem is to keep the sequence from getting added to the
query's rangetable (or at least keep it out of the jointree).  There
is some speculation about this in the archives, starting at
http://archives.postgresql.org/pgsql-hackers/2001-08/msg00589.php
The regclass-datatype part of this is in the system now, but I didn't
get any further than that.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Roadmap for FE/BE protocol redesign
Next
From: Rod Taylor
Date:
Subject: Re: Sequence functions