Throw a more on-point error for functions depending on columns.
commit42b041243c00fb20023c983357e7f1ffd3710fff
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 28 Apr 2024 18:34:21 +0000 (28 14:34 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 28 Apr 2024 18:34:21 +0000 (28 14:34 -0400)
tree5e6674e31b9b564e25af0752045588df462dee0e
parent4019285c064028fbf613f0e43766416a63b826db
Throw a more on-point error for functions depending on columns.

ALTER COLUMN TYPE wasn't expecting to find any pg_proc objects
depending on the column whose type is to be altered.  That indeed
wasn't possible when this code was written, but it is possible
since we introduced new-style SQL function bodies.

It's about as difficult to fix this case as it is to fix dependent
views, and we've been punting on those for years, so I don't feel
too awful about punting for functions too.  (I sure wouldn't risk
back-patching such code.)  So just throw a more user-facing error.
Also, adjust some of the existing comments to reflect that these
are all pretty much the same issue.

(This patch also fixes it so we will tolerate finding such a
dependency during ALTER COLUMN SET EXPRESSION; in that, we need
not do anything to the function, so no error is wanted.  That
problem is new in HEAD.)

Per bug #18449 from Alexander Lakhin.  Back-patch to v14 where
we added new-style SQL functions.

Discussion: https://postgr.es/m/18449-f8248467aaa294d5@postgresql.org
src/backend/commands/tablecmds.c