Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column
Date
Msg-id 20180517163631.cjphtsklcwhjdf6w@alvherre.pgsql
Whole thread Raw
In response to Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column  (Andres Freund <andres@anarazel.de>)
Responses Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column  (Michael Paquier <michael@paquier.xyz>)
List 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


pgsql-bugs by date:

Previous
From: Andres Freund
Date:
Subject: Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column
Next
From: PG Bug reporting form
Date:
Subject: BUG #15205: ERROR: table row type and query-specified row type do notmatch