From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Improving the names generated for indexes on expressions |
Date: | 2025-09-16 01:56:50 |
Message-ID: | 876799.1757987810@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
In the wake of the discussion around bug #18959 [1], here is
a modest proposal for improving the names we pick for expression
indexes. The commit message explains the details, but this
example should give the flavor:
postgres=# create table mytab (f1 int, f2 text, f3 text);
CREATE TABLE
postgres=# create index on mytab(abs(f1 + 1));
CREATE INDEX
postgres=# create index on mytab((f2 || f3));
CREATE INDEX
postgres=# \d mytab
Table "public.mytab"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
f1 | integer | | |
f2 | text | | |
f3 | text | | |
Indexes:
"mytab_abs_f1_+_1_idx" btree (abs(f1 + 1))
"mytab_f2_||_f3_idx" btree ((f2 || f3))
Formerly you got:
"mytab_abs_idx" btree (abs(f1 + 1))
"mytab_expr_idx" btree ((f2 || f3))
There's plenty of room for differing opinions about how to do this,
so have at it.
regards, tom lane
[1] https://www.postgresql.org/message-id/flat/18959-f63b53b864bb1417%40postgresql.org
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Improve-the-names-generated-for-indexes-on-expres.patch | text/x-diff | 43.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-09-16 02:08:40 | Re: BUG #18959: Name collisions of expression indexes during parallel Index creations on a pratitioned table. |
Previous Message | Michael Paquier | 2025-09-16 01:51:20 | Re: Resetting recovery target parameters in pg_createsubscriber |