From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | fabriziomello(at)gmail(dot)com |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements |
Date: | 2013-06-20 04:52:18 |
Message-ID: | CA+HiwqFoOOM0i_q=sgJFSeioRh=F9DZOZe6XOc3L4pF-S_jCiQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jun 19, 2013 at 12:45 PM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
> On Mon, Jun 17, 2013 at 11:33 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>>
>> Replace/alter the object if it already exists, but fail if it does not
>> exist.
>>
>> The complete set of variants is:
>>
>> - object does not exist:
>>
>> - proceed (normal CREATE)
>> - error (my above description)
>>
>> - object exists:
>>
>> - replace (CREATE OR REPLACE)
>> - skip (CREATE IF NOT EXISTS)
>> - error (normal CREATE)
>>
>
> I understood.
>
> The syntax can be like that?
> - CREATE [ OR REPLACE | IF NOT EXISTS ] AGGREGATE ...
> - CREATE [ OR REPLACE | IF NOT EXISTS ] OPERATOR ...
> - CREATE [ OR REPLACE | IF NOT EXISTS ] FUNCTION ...
>
> I can add this features too, but IMHO it is more prudent at this CF we just
> implement the IF NOT EXISTS according the initial proposal.
>
> I'm planning another patch do next CF to add support to "IF NOT EXISTS" to
> others "CREATE" statements. See my planning [1].
>
Is it possible to:
CREATE [ OR REPLACE | IF NOT EXISTS ] OPERATOR CLASS
I am in a situation where I need to conditionally create an operator
class (that is, create only if already does not exist).
For example, currently, while trying out pg_trgm and a new external
module pg_bigm, I found that, currently, only one of them can be
installed in a database at a time. pg_bigm for backward compatibility
also creates pg_trgm_ops operator class with its member functions
being the ones implemented by pg_bigm. So, if pg_trgm already exists,
then I won't be able to add pg_bigm (which has its own use cases and
we can probably have the two co-exist) and vice versa. It would be
nice if we had the above feature so that pg_bigm or pg_trgm can use
'IF NOT EXISTS' while creating pg_trgm_ops operator class.
Thoughts?
--
Amit Langote
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2013-06-20 05:21:23 | Re: Bugfix and new feature for PGXS |
Previous Message | Craig Ringer | 2013-06-20 04:45:48 | Re: C++ compiler |