Re: Improving the names generated for indexes on expressions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Improving the names generated for indexes on expressions
Date: 2025-09-16 12:39:21
Message-ID: CAKFQuwYBK03RSydd6ZqmvJ2NUwocyyfCjJZEeXN9yoF0vgGOLg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tuesday, September 16, 2025, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Tue, Sep 16, 2025 at 12:56 AM David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> > If there are no function names present, output “expr” in lieu of a
> function name. Then just output any columns that are present. No
> operators, no constants.
>
> In the previous discussion, the user's expression indexes were on
> these expressions:
>
> jsondata -> 'a' -> 'b'
> jsondata -> 'x' -> 'y'
>
> So "no operators, no constants" wouldn't really allow us to make any
> useful progress, inasmuch as it would throw away everything that
> matters.
>

Wouldn’t mind special-casing json/jsonb in the algorithm:
tbl_col.const.const_idx

More generally, maybe map all the various common accessor operators to “.”
instead of using them directly and capture the constants when chained from
a column.

This forces the need for double-quoting but that doesn’t seem like
something we can really avoid.

Keeps the name short by collapsing the operator to a single symbol, and
removing single quotes from the constants.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Core Studios Inc. 2025-09-16 12:47:08 Re: Incorrect result of bitmap heap scan.
Previous Message Tom Lane 2025-09-16 12:36:34 Re: Improving the names generated for indexes on expressions