Re: CREATE IF NOT EXISTS INDEX - Mailing list pgsql-hackers

From Kirk Roybal
Subject Re: CREATE IF NOT EXISTS INDEX
Date
Msg-id 46dc0505cbebcd8603f8480efcc1bb6e@webfinish.com
Whole thread Raw
In response to Re: CREATE IF NOT EXISTS INDEX  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
<p>On 2014-09-30 17:01, Josh Berkus wrote:<blockquote style="padding-left:5px; border-left:#1010ff 2px solid;
margin-left:5px"type="cite"><pre>On 09/30/2014 02:43 PM, Tom Lane wrote:</pre><blockquote style="padding-left:5px;
border-left:#1010ff2px solid; margin-left:5px" type="cite">Fabrízio de Royes Mello <<a
href="mailto:fabriziomello@gmail.com">fabriziomello@gmail.com</a>>writes: <blockquote style="padding-left:5px;
border-left:#1010ff2px solid; margin-left:5px" type="cite">What's your thoughts about we implement IF NOT EXISTS for
CREATEINDEX?</blockquote> It's got the same semantic problems as every other variant of CINE. If there were a huge
groundswellof demand for it, maybe we'd hold our noses and do it anyway. But I'm against doing it without
that.</blockquote><pre>Thisisn't the sort of thing there would ever be a clamor of support 
for, because it's just not that visible of a feature.  It's more of a
regular annoyance for those who encounter it.  More importantly, adding
an IF NOT EXISTS to CREATE INDEX would allow complete idempotent "create
this bunch of tables" scripts, since now the "create index" statements
could be included.  This would be very nice for schema management tools.

I do think it should be name-based.  While an "IF NOT EXISTS" which
checked for a duplicate column declartion would be nice, there's a raft
of issues with implementing it that way.  Users I know are generally
just looking to avoid getting a transaction-halting error when they run
the same create index statement twice.

<span class="sig">--
Josh Berkus
PostgreSQL Experts Inc.
<a href="http://pgexperts.com">http://pgexperts.com</a>

</span></pre></blockquote><p>I second this evaluation.   Using build tools to manage schemas, there is no expectation
thatthe full index signature is checked.  Any index of the same name would be considered a collision for my
purposes.<p>Itis much easier to show CINE to a developer than to explain how an anonymous code block does the same
thing.<p>/Kirk

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Next
From: Alvaro Herrera
Date:
Subject: Re: Per table autovacuum vacuum cost limit behaviour strange