Re: Expression index can get an empty generated column name - Mailing list pgsql-hackers

From Chauhan Dhruv
Subject Re: Expression index can get an empty generated column name
Date
Msg-id CANWwWcpsuwAxeAbA-PeEFU8PnReEKiXv4Wt0b==FF=+UssYdKA@mail.gmail.com
Whole thread
List pgsql-hackers
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
Attachment

pgsql-hackers by date:

Previous
From: Tender Wang
Date:
Subject: Re: Partition pruning can incorrectly exclude a RANGE default partition
Next
From: Chao Li
Date:
Subject: Re: tablecmds: fix bug where index rebuild loses replica identity on partitions