From: Alexander Lakhin <exclusion@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Subject: Re: BUG #18449: Altering column type fails when an SQL routine depends on the column
Date: Wed, 1 May 2024 16:00:00 +0300
Message-ID: <548a47bc-87ae-b3df-c6a2-60b9966f808b@gmail.com> (raw)
In-Reply-To: <403599.1714268901@sss.pgh.pa.us>
References: <18449-f8248467aaa294d5@postgresql.org>
<403599.1714268901@sss.pgh.pa.us>
Hello Tom,
28.04.2024 04:48, Tom Lane wrote:
> Thanks for the report. It looks like most of the other hard cases
> in RememberAllDependentForRebuilding just error out with code
> along the lines of
>
> ereport(ERROR,
> (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> errmsg("cannot alter type of a column used by a view or rule"),
>
> I'm inclined to do likewise for functions.
I've discovered one more case, presumably as hard as the other ones:
CREATE TABLE t(a int);
CREATE PUBLICATION p FOR TABLE t WHERE (a > 0);
ALTER TABLE t ALTER COLUMN a TYPE bigint;
fails with:
ERROR: unexpected object depending on column: publication of table t in publication p
Reproduced on REL_15_STABLE (52e4f0cd4) .. master.
> We could imagine trying
> to re-parse the function definition against the new column type,
> but there are way too many ways for that to go wrong. Just for
> starters, there are possibly-security-grade hazards if the current
> search_path isn't what it was when the function was created. There's
> no guarantee that we'd succeed anyway, eg the new column type might
> not work for some function or operator that's applied to it, and if
> not the resulting error message would likely be very surprising.
It looks like all these considerations apply to expressions defining row
filters for publications...
Best regards,
Alexander
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: exclusion@gmail.com, tgl@sss.pgh.pa.us, peter.eisentraut@enterprisedb.com
Subject: Re: BUG #18449: Altering column type fails when an SQL routine depends on the column
In-Reply-To: <548a47bc-87ae-b3df-c6a2-60b9966f808b@gmail.com>
* 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