Re: CREATE IF NOT EXISTS INDEX

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: CREATE IF NOT EXISTS INDEX
Дата
Msg-id 542B36A5.4010600@agliodbs.com
обсуждение исходный текст
Ответ на CREATE IF NOT EXISTS INDEX  (Fabrízio de Royes Mello <fabriziomello@gmail.com>)
Ответы Re: CREATE IF NOT EXISTS INDEX
Список pgsql-hackers
On 09/30/2014 03:53 PM, Andres Freund wrote:
> On 2014-09-30 18:47:24 -0400, Tom Lane wrote:
>> Josh Berkus <josh@agliodbs.com> writes:
>>> On 09/30/2014 02:43 PM, Tom Lane wrote:
>>>> Fabrízio de Royes Mello <fabriziomello@gmail.com> writes:
>>>>> What's your thoughts about we implement IF NOT EXISTS for CREATE INDEX?
>>
>>>> It's got the same semantic problems as every other variant of CINE.
>>
>>> I do think it should be name-based.
>>
>> Name-based, eh?  Don't you recall that in modern practice, people
>> generally don't specify names for indexes at all?  They've usually
>> got system-generated names, which doesn't seem like a very cool thing
>> to have scripts depending on.
> 
> Good point. I think it's fair enough to only allow CINE on named
> indexes.

On the other hand, the way we form system-generated names is predicable,
so I think it would be perfectly OK to include them.  Desirable, in fact.

For example, if I did this:

CREATE INDEX ON tab1 (cola, colb);

CREATE INDEX IF NOT EXISTS ON tab1 (cola, colb);

I would expect to not end up with two indexes on those two particular
columns, and if we don't omit system-generated names, I won't.

Not that I'm a fan of omitting the name ...

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: CREATE IF NOT EXISTS INDEX
Следующее
От: Andres Freund
Дата:
Сообщение: Re: CREATE IF NOT EXISTS INDEX