Re: BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Kevin Humphreys <kmanh999@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2022-03-16T02:28:09Z
Lists: pgsql-bugs
On Tuesday, March 15, 2022, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>
> > Is there any recommendation you would have for mitigation besides not
> > dropping functions that may be used by generated columns?
>
> I don't see any good user-level workaround :-(.
>
>
Create a dummy view that simply calls the function with null inputs.  That
view then will at least enforce the dependency.

David J.

Commits

  1. Fix bogus dependency handling for GENERATED expressions.

  2. Move pg_attrdef manipulation code into new file catalog/pg_attrdef.c.