Re: creating index names automatically?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: creating index names automatically?
Дата
Msg-id 3390.1261335513@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: creating index names automatically?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: creating index names automatically?  (Michael Glaesemann <grzm@seespotcode.net>)
Список pgsql-hackers
I wrote:
> Although, having said that, I realize we just opened that can of worms
> with the exclusion-constraint patch:

> regression=# create table foo (f1 text, exclude (lower(f1) with =));
> NOTICE:  CREATE TABLE / EXCLUDE will create implicit index "foo_exclusion" for table "foo"
> CREATE TABLE

> The above behavior seems to need improvement already.

And poking further, CREATE TABLE LIKE INCLUDING INDEXES is another place
where we've already bought into automatically generating index names for
arbitrary non-constraint indexes.  And it's even dumber --- you get
names involving "_key" for indexes that aren't even unique.  So it seems
like we already have a bit of a problem here.

The first thoughts I have about this are:

* Use FigureColname to derive a name for an expression column, except
I'd be inclined to have the fallback case be "expr" not "?column?".

* Append "_index" not "_key" if it's not a constraint-related index.

I'm also a bit tempted to propose that we start using FigureColname
for the actual attribute names of expression indexes, instead of the
not terribly helpful "pg_expression_n" convention.  In this case we'd
have to append a number if necessary to make the name unique among the
column names of the index.

Comments?
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Removing pg_migrator limitations
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Removing pg_migrator limitations