Thread
Commits
-
Rethink the dependencies recorded for FieldSelect/FieldStore nodes.
- 8be1022425a3 10.1 landed
- 6784d7a1dc69 11.0 landed
- cf0331a54c9b 9.6.6 landed
- be203c36a6e8 9.3.20 landed
- adcfa7bd16f4 9.2.24 landed
- 37fb01cb04b4 9.5.10 landed
- 376ac922df78 9.4.15 landed
-
Fix some oversights in expression dependency recording.
- f3ea3e3e820b 11.0 cited
-
FieldSelect/FieldStore dependencies, take 2
Tom Lane <tgl@sss.pgh.pa.us> — 2017-10-27T00:29:06Z
I had a nagging feeling that commit f3ea3e3e8 was not quite covering all the bases with respect to what dependencies to record for FieldSelect/FieldStore nodes: it looked at the result type, but what about the input type? Just now, while fooling around with domains over composite, I stumbled across a case that shows what's missing: regression=# create type complex as (r float8, i float8); CREATE TYPE regression=# create domain dcomplex as complex check((value).r > (value).i); CREATE DOMAIN regression=# select pg_get_constraintdef((select max(oid) from pg_constraint)); pg_get_constraintdef --------------------------------- CHECK (((VALUE).r > (VALUE).i)) (1 row) regression=# alter type complex drop attribute r; ALTER TYPE regression=# select pg_get_constraintdef((select max(oid) from pg_constraint)); pg_get_constraintdef -------------------------------------------------------------- CHECK (((VALUE)."........pg.dropped.1........" > (VALUE).i)) (1 row) Nothing seems to crash at this point, probably because we insert nulls into dropped columns, so the CHECK just sees a NULL value for "r" whenever it runs. But obviously, the next dump/reload or pg_upgrade is not going to end well. So what this shows is that we need a dependency on the particular column named by the FieldSelect or FieldStore. Under normal circumstances, that obviates the need for a dependency on the FieldSelect's result type, which would match the column type. I think concretely what we need is the attached. (BTW, the getBaseType() is only necessary in HEAD, since before domains-over-composites the argument of a FieldSelect couldn't be a domain type.) regards, tom lane