Re: Improving the names generated for indexes on expressions
От | Pavel Stehule |
---|---|
Тема | Re: Improving the names generated for indexes on expressions |
Дата | |
Msg-id | CAFj8pRB4NmGMo=5LhtMgVSX1rEJVpnEePkObwo5FRnXBqy_Otw@mail.gmail.com обсуждение исходный текст |
Ответ на | Improving the names generated for indexes on expressions (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
Hi
út 16. 9. 2025 v 3:57 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
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.
-1
I don't like the introduction of the necessity to use double quotes. If somebody needs a better name, then he can use an explicit name.
Regards
Pavel
regards, tom lane
[1] https://www.postgresql.org/message-id/flat/18959-f63b53b864bb1417%40postgresql.org
В списке pgsql-hackers по дате отправления: