pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: kmanh999@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE
Date: Tue, 15 Mar 2022 17:18:55 -0400
Message-ID: <425437.1647379135@sss.pgh.pa.us> (raw)
In-Reply-To: <412466.1647374777@sss.pgh.pa.us>
References: <17439-7df4421197e928f0@postgresql.org>
	<339142.1647369200@sss.pgh.pa.us>
	<412466.1647374777@sss.pgh.pa.us>

I wrote:
> So it looks to me like the generation expression's dependencies
> should be NORMAL not AUTO in all cases.  I'm less sure about
> whether to mess with any other aspects of the dependency linkages.
> That might not be something to fool with in back branches, anyway.

Ugh ... this opens a much larger can of worms than I thought.
There are two problems:

1. If these dependencies are NORMAL, then we cannot tell them apart from
the column's other dependencies -- such as the ones on its type and
collation.  (The generation expression could easily have dependencies on
types and collations.)  I think we really have to switch them so that
the referencing object is the pg_attrdef entry not the column itself,
just as is done for ordinary defaults.  That's easy so far as
StoreAttrDefault itself is concerned, but ...

2. ALTER TABLE contains multiple assumptions about the structure of
dependencies for generation expressions, and they'll all be broken
by such a change.  There's even a very explicit claim that any such
dependency could only be on another column of the same table :-(.

The regression tests reveal two or three places in tablecmds.c that
need to change, and I'm worried there may be other places that
aren't covered.

So it's looking to me like we probably can't fix this in the back
branches; it'll have to be a HEAD-only change.

			regards, tom lane





view thread (9+ messages)  latest in thread

Message-ID: <425437.1647379135@sss.pgh.pa.us>
Permalink:  ../425437.1647379135@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/425437.1647379135@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, peter.eisentraut@enterprisedb.com, kmanh999@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE
  In-Reply-To: <425437.1647379135@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox