Re: BUG #15198: nextval() accepts tables/indexes when adding a default to a column

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: Feike Steenbergen <feikesteenbergen@gmail.com>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-bugs@lists.postgresql.org
Date: 2018-05-17T16:36:31Z
Lists: pgsql-bugs
On 2018-May-17, Andres Freund wrote:

> These alternatives seem like they're not an improvement.  I don't think
> it's worth doing anything here.

I agree.

If our nextval was less opaque, it'd be worth doing better.  I mean
something like

CREATE TABLE tt (
   col integer DEFAULT someseq.nextval
   ...
)

which I think has been proposed over the years (and ultimately rejected;
and even if implemented[1], this would not prevent our current syntax
from being accepted).  But we've stuck with the function-call syntax for
better or worse.  Let's live with it.


[1] That syntax currently gets this funny error:

alvherre=# create table ff (a int default seq.nextval);
ERROR:  missing FROM-clause entry for table "seq"

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services