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

From David G. Johnston
Subject Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column
Date
Msg-id CAKFQuwYCgnmCLsE9nNAjVupMrfRrU0O_PnQoTzZSO-gA__ooiw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column  (Feike Steenbergen <feikesteenbergen@gmail.com>)
List pgsql-bugs
On Wed, May 16, 2018 at 11:41 PM, Feike Steenbergen <feikesteenbergen@gmail.com> wrote:
+       if (!IsSequence( find_oid_referenced (defobject) ) )
+               elog(ERROR, "Column defaults can only depend on sequences")

​Except column defaults can depends on lots of things - its only if the column default happens to invoke nextval that the specific type of object being passed to nextval needs to be a sequence.

You might be able to stick "something" in the recordDependencyOnExpr(&defobject, expr, NIL, DEPENDENCY_NORMAL); call (have gone and found that code...) but catalog/heap.c:: StoreAttrDefault itself doesn't operate at the level of detail.

Ultimately you'd have to add a hack for the function name nextval...

David J.

pgsql-bugs by date:

Previous
From: Huong Dangminh
Date:
Subject: RE: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT
Next
From: PG Bug reporting form
Date:
Subject: BUG #15204: Export to CSV doesn't work in Query tools