Re: Expression index can get an empty generated column name

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chauhan Dhruv <chauhandhruv351(at)gmail(dot)com>
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-27 19:41:25
Message-ID: 3979764.1785181285@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Chauhan Dhruv <chauhandhruv351(at)gmail(dot)com> writes:
> If you CREATE INDEX on an expression without naming the index, Postgres
> generates a name for the index column from that expression. For some
> expressions the generated name comes out empty, so the index column is
> left with an empty attname.

> Example (a whole-row reference):

> CREATE TABLE t (a int, b int);
> CREATE INDEX ON t ((t IS NOT NULL));

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.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2026-07-27 19:41:41 Re: Is there value in having optimizer stats for joins/foreignkeys?
Previous Message Euler Taveira 2026-07-27 19:36:39 doc: fast access to server parameters