Re: Improving the names generated for indexes on expressions - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Improving the names generated for indexes on expressions
Date
Msg-id CAKFQuwYBK03RSydd6ZqmvJ2NUwocyyfCjJZEeXN9yoF0vgGOLg@mail.gmail.com
Whole thread Raw
In response to Re: Improving the names generated for indexes on expressions  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Improving the names generated for indexes on expressions
List pgsql-hackers
On Tuesday, September 16, 2025, Robert Haas <robertmhaas@gmail.com> wrote:
On Tue, Sep 16, 2025 at 12:56 AM David G. Johnston
<david.g.johnston@gmail.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.

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Improving the names generated for indexes on expressions
Next
From: "Core Studios Inc."
Date:
Subject: Re: Incorrect result of bitmap heap scan.