On Wed, Jun 19, 2013 at 12:45 PM, Fabrízio de Royes Mello <fabriziome...@gmail.com> wrote: > On Mon, Jun 17, 2013 at 11:33 PM, Peter Eisentraut <pete...@gmx.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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers