Re: BUG #15198: nextval() accepts tables/indexes when adding a default to a column
David G. Johnston <david.g.johnston@gmail.com>
From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Feike Steenbergen <feikesteenbergen@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
Tom Lane <tgl@sss.pgh.pa.us>, pgsql-bugs@lists.postgresql.org
Date: 2018-05-17T12:25:54Z
Lists: 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.