Re: Implementing IF NOT EXISTS clause for all CREATE TYPE variants - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Implementing IF NOT EXISTS clause for all CREATE TYPE variants
Date
Msg-id 30937.1760292577@sss.pgh.pa.us
Whole thread Raw
In response to Implementing IF NOT EXISTS clause for all CREATE TYPE variants  (Bram Hagens <bram@bramh.me>)
List pgsql-hackers
Bram Hagens <bram@bramh.me> writes:
> I would like to propose adding IF NOT EXISTS support to all CREATE TYPE 
> variants
> for consistency with other CREATE commands (CREATE TABLE, CREATE INDEX, 
> etc.).

There has been a *ton* of discussion about this over the years.
If you didn't find anything in the archives, you didn't look hard.

The short answer about why this isn't as useful as it might seem
is that after CINE, your application is entitled to make exactly
zero assumptions about the properties of the object, other than
that it exists.  CREATE OR REPLACE functionality is a lot more
reliable to depend on, since if it succeeds you know exactly
how the object is defined.  (However, then you have the issue
of whether the server can cope with possibly propagating changes
in the object definition.)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Is there public API to fetch errcode?
Next
From: Peter Geoghegan
Date:
Subject: Re: index prefetching