| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | pgsql-hackers(at)postgreSQL(dot)org |
| Subject: | FieldSelect/FieldStore dependencies, take 2 |
| Date: | 2017-10-27 00:29:06 |
| Message-ID: | 22571.1509064146@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| Attachment | Content-Type | Size |
|---|---|---|
| fieldselect-dependencies-take-two.patch | text/x-diff | 2.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2017-10-27 00:41:44 | Re: taking stdbool.h into use |
| Previous Message | Tsunakawa, Takayuki | 2017-10-27 00:26:32 | Re: Remove secondary checkpoint |