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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Feike Steenbergen <feikesteenbergen(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15198: nextval() accepts tables/indexes when adding a default to a column
Date: 2018-05-17 12:25:54
Message-ID: CAKFQuwYCgnmCLsE9nNAjVupMrfRrU0O_PnQoTzZSO-gA__ooiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, May 16, 2018 at 11:41 PM, Feike Steenbergen <
feikesteenbergen(at)gmail(dot)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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2018-05-17 13:50:55 BUG #15204: Export to CSV doesn't work in Query tools
Previous Message Huong Dangminh 2018-05-17 11:35:00 RE: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT