Tom Lane <
tgl@sss.pgh.pa.us> writes:
> Hmm, yeah, that's not great, although I'd argue that the real issue in
> this particular example is that we should treat the whole-row Var as
> being named "t" rather than being ignored. Still, installing a
> fallback of "expr" isn't a bad idea.
good idea! A whole-row Var now contributes the relation's name, and
"expr" remains as a fallback for expressions that still yield no text
(e.g. a constant that sanitizes away to nothing).
CREATE TABLE t (a int, b int);
CREATE INDEX ON t ((t IS NOT NULL)); -- index t_t_idx, column "t"
CREATE INDEX ON t ((','::text)); -- index t_expr_idx, column "expr"
CREATE INDEX ON t ((a + b)); -- index t_a_b_idx, column "a_b"
Regression test updated. make check is green.
Patch is attached.
Thanks,
Dhruv