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

From Andres Freund
Subject Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column
Date
Msg-id 20180517162119.qslb3bkftvomqt5e@alap3.anarazel.de
Whole thread Raw
In response to Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column  (Feike Steenbergen <feikesteenbergen@gmail.com>)
Responses Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column
List pgsql-bugs
Hi,

On 2018-05-17 08:41:53 +0200, Feike Steenbergen wrote:
> On 16 May 2018 at 16:20, Peter Eisentraut
> <peter.eisentraut@2ndquadrant.com> wrote:
> 
> > In this case, they are putting the erroneous call into a column default,
> > so the difference ends up being getting the error at setup time versus
> > at run time, which is a difference of significance.
> 
> Yes, I'm not particularly concerned with nextval taking a regclass as
> an argument, and
> therefore raising this error, but I'd rather have this error at DDL
> time than at DML time.
> 
> I don't know how hard it would be to implement, but say, calling
> currval(regclass) when
> a default is defined should already throw this error at DDL time.
> 
> Or, when registering the default in the catalog, we verify that it is
> actually a sequence:

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

Greetings,

Andres Freund


pgsql-bugs by date:

Previous
From: reader 1001
Date:
Subject: Re: Abnormal JSON query performance
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column