postgresql/src
Tom Lane 0b292bed92 Close old gap in dependency checks for functions returning composite.
The dependency logic failed to register a column-level dependency
when a view or rule contains a reference to a specific column of
the result of a function-returning-composite.  That meant you could
drop the column from the composite type, causing trouble for future
executions of the view.  We've known about this for years, but never
summoned the energy to actually fix it, instead installing various
low-level defenses to prevent crashing on references to dropped columns.
We had to do that to plug the hole in stable branches, where there might
be pre-existing broken references; but let's fix the root cause today.

To do that, add some logic (borrowed from get_rte_attribute_is_dropped)
to find_expr_references_walker, to check whether a Var referencing an
RTE_FUNCTION RTE is referencing a column of a composite type, and if
so add the proper dependency.

However ... it seems mighty unwise to remove said low-level defenses,
since there could be other bugs now or in the future that allow
reaching them.  By the same token, letting those defenses go untested
seems unwise.  Hence, rather than just dropping the associated test
cases, hack them to continue working by the expedient of manually
dropping the pg_depend entries that this fix installs.

Back-patch into v15.  I don't want to risk changing this behavior
in stable branches, but it seems not too late for v15.  (Since
we have already forced initdb for beta3, we can be sure that all
production v15 installations will have these added dependencies.)

Discussion: https://postgr.es/m/182492.1658431155@sss.pgh.pa.us
2022-07-22 12:46:42 -04:00
..
backend Close old gap in dependency checks for functions returning composite. 2022-07-22 12:46:42 -04:00
bin Fix minor memory leaks in psql's tab completion. 2022-07-22 10:53:26 -04:00
common Add output directory argument to generate-unicode_norm_table.pl 2022-07-18 12:24:39 -07:00
fe_utils Fix minor memory leaks in psql's tab completion. 2022-07-22 10:53:26 -04:00
include Remove O_FSYNC and associated macros. 2022-07-22 12:41:17 +12:00
interfaces Make subquery aliases optional in the FROM clause. 2022-07-20 09:29:42 +01:00
makefiles Default to hidden visibility for extension libraries where possible 2022-07-17 17:49:51 -07:00
pl Add PGDLLEXPORTS to some plpgsql function declarations 2022-07-20 10:24:50 +02:00
port Fix get_dirent_type() for Windows junction points. 2022-07-22 16:57:12 +12:00
template Remove HP-UX port. 2022-07-08 14:05:05 +12:00
test Close old gap in dependency checks for functions returning composite. 2022-07-22 12:46:42 -04:00
timezone Update time zone data files to tzdata release 2022a. 2022-05-05 14:54:53 -04:00
tools Remove fls(), use pg_leftmost_one_pos32() instead. 2022-07-22 10:41:50 +12:00
tutorial Update copyright for 2022 2022-01-07 19:04:57 -05:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Default to hidden visibility for extension libraries where possible 2022-07-17 17:49:51 -07:00
Makefile.shlib Default to hidden visibility for extension libraries where possible 2022-07-17 17:49:51 -07:00
nls-global.mk Fix for make unportability 2022-07-13 09:15:01 +02:00