Re: CREATE IF NOT EXISTS INDEX

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: Fabrízio Mello <fabriziomello(at)gmail(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, José Luis Tallón <jltallon(at)adv-solutions(dot)net>
Subject: Re: CREATE IF NOT EXISTS INDEX
Date: 2014-10-03 00:55:46
Message-ID: CABRT9RBWOuSgEYQP3GOA_nj7WR-dihE5GSc+09QFV3goyR4fAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 3, 2014 at 2:15 AM, Marti Raudsepp <marti(at)juffo(dot)org> wrote:
> + ereport(NOTICE,
> + (errcode(ERRCODE_DUPLICATE_TABLE),
> + errmsg("relation \"%s\" already exists, skipping",
> + indexRelationName)));
>
> 1. Clearly "relation" should be "index".
> 2. Use ERRCODE_DUPLICATE_OBJECT not TABLE

My bad, this code is OK. The current code already uses "relation" and
TABLE elsewhere because indexes share the same namespace with tables.

+ /*
+ * Throw an exception when IF NOT EXISTS is used without a named
+ * index
+ */

I'd say "without an index name". And the line goes beyond 80 characters wide.

I would also move this check to after all the attributes have been
assigned, rather than splitting the assignments in half.

Regards,
Marti

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-10-03 01:18:14 Re: TAP test breakage on MacOS X
Previous Message Peter Geoghegan 2014-10-03 00:54:06 Re: Yet another abort-early plan disaster on 9.3