Re: CREATE IF NOT EXISTS INDEX

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CREATE IF NOT EXISTS INDEX
Date: 2014-09-30 22:39:54
Message-ID: CAFcNs+pW+BJdqHNWbFpi1apoExOJWbhPovxyPekJqBe_rZ_n=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 30, 2014 at 7:01 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>
> On 09/30/2014 02:43 PM, Tom Lane wrote:
> > =?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= <fabriziomello(at)gmail(dot)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.
> >
> > If there were a huge groundswell of demand for it, maybe we'd hold our
> > noses and do it anyway. But I'm against doing it without that.
>
> This isn'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.
>

Here is the patch... it's name-based.

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello

Attachment Content-Type Size
create_index_if_not_exists_v1.patch text/x-diff 10.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-09-30 22:47:24 Re: CREATE IF NOT EXISTS INDEX
Previous Message Peter Geoghegan 2014-09-30 22:24:14 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}