| From: | Chauhan Dhruv <chauhandhruv351(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com> |
| Subject: | Re: Expression index can get an empty generated column name |
| Date: | 2026-07-28 08:46:43 |
| Message-ID: | CANWwWcpsuwAxeAbA-PeEFU8PnReEKiXv4Wt0b==FF=+UssYdKA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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 | Content-Type | Size |
|---|---|---|
| v2-0001-Avoid-empty-generated-names-for-expression-index-.patch | text/x-patch | 5.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-07-28 08:46:50 | Re: tablecmds: fix bug where index rebuild loses replica identity on partitions |
| Previous Message | Michael Paquier | 2026-07-28 08:44:15 | Re: lost lock during toasting allows fk violation |