postgresql/src/backend
Tom Lane cb02fcb4c9 Fix bogus dependency handling for GENERATED expressions.
For GENERATED columns, we record all dependencies of the generation
expression as AUTO dependencies of the column itself.  This means
that the generated column is silently dropped if any dependency
is removed, even if CASCADE wasn't specified.  This is at least
a POLA violation, but I think it's actually based on a misreading
of the standard.  The standard does say that you can't drop a
dependent GENERATED column in RESTRICT mode; but that's buried down
in a subparagraph, on a different page from some pseudocode that
makes it look like an AUTO drop is being suggested.

Change this to be more like the way that we handle regular default
expressions, ie record the dependencies as NORMAL dependencies of
the pg_attrdef entry.  Also, make the pg_attrdef entry's dependency
on the column itself be INTERNAL not AUTO.  That has two effects:

* the column will go away, not just lose its default, if any
dependency of the expression is dropped with CASCADE.  So we
don't need any special mechanism to make that happen.

* it provides an additional cross-check preventing someone from
dropping the default expression without dropping the column.

catversion bump because of change in the contents of pg_depend
(which also requires a change in one information_schema view).

Per bug #17439 from Kevin Humphreys.  Although this is a longstanding
bug, it seems impractical to back-patch because of the need for
catalog contents changes.

Discussion: https://postgr.es/m/17439-7df4421197e928f0@postgresql.org
2022-03-21 14:58:49 -04:00
..
access Remove workarounds for avoiding [U]INT64_FORMAT in translatable strings. 2022-03-21 11:11:55 -04:00
bootstrap pg_upgrade: Preserve relfilenodes and tablespace OIDs. 2022-01-17 13:40:27 -05:00
catalog Fix bogus dependency handling for GENERATED expressions. 2022-03-21 14:58:49 -04:00
commands Fix bogus dependency handling for GENERATED expressions. 2022-03-21 14:58:49 -04:00
executor Blind fix for uninitialized memory bug in ba9a7e3921 2022-03-20 22:10:24 +01:00
foreign Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
jit Silence LLVM 14 API deprecation warnings. 2022-03-16 10:30:55 +13:00
lib dshash: Add sequential scan support. 2022-03-10 12:57:05 -08:00
libpq Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
main Fix collection of typos in the code and the documentation 2022-03-15 11:29:35 +09:00
nodes Allow specifying row filters for logical replication of tables. 2022-02-22 08:11:50 +05:30
optimizer Don't bother to attach column name lists to RowExprs of named types. 2022-03-17 18:25:44 -04:00
parser Add parse_analyze_withcb() 2022-03-09 11:08:16 +01:00
partitioning Fix misuse of "const" qualifier. 2022-02-13 19:20:56 -05:00
po Translation updates 2021-06-21 12:33:50 +02:00
port Ensure that the argument of shmdt(2) is declared "void *". 2022-02-15 17:17:28 -05:00
postmaster pgstat: separate "xact level" handling out of relation specific functions. 2022-03-20 19:12:09 -07:00
regex Call pg_newlocale_from_collation() also with default collation 2022-01-20 09:50:18 +01:00
replication Fix typo in file identification 2022-03-21 12:35:48 +02:00
rewrite Don't bother to attach column name lists to RowExprs of named types. 2022-03-17 18:25:44 -04:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Fix various typos, grammar and code style in comments and docs 2022-01-25 09:40:04 +09:00
storage Fix race between DROP TABLESPACE and checkpointing. 2022-03-16 17:20:24 +13:00
tcop Add parse_analyze_withcb() 2022-03-09 11:08:16 +01:00
tsearch Update copyright for 2022 2022-01-07 19:04:57 -05:00
utils Remove workarounds for avoiding [U]INT64_FORMAT in translatable strings. 2022-03-21 11:11:55 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Server-side gzip compression. 2022-01-24 15:13:18 -05:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Report progress of startup operations that take a long time. 2021-10-25 11:51:57 -04:00