aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/nodeFuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-03-21 14:58:49 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-03-21 14:58:49 -0400
commitcb02fcb4c95bae08adaca1202c2081cfc81a28b5 (patch)
treeddefe5d7587999509e2bd6f4223a961a01b499ce /src/backend/nodes/nodeFuncs.c
parent17f3bc09284e1b529cdf524bbba709af6493f30c (diff)
downloadpostgresql-cb02fcb4c95bae08adaca1202c2081cfc81a28b5.tar.gz
postgresql-cb02fcb4c95bae08adaca1202c2081cfc81a28b5.zip
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
Diffstat (limited to 'src/backend/nodes/nodeFuncs.c')
0 files changed, 0 insertions, 0 deletions