Re: Add column if not exists (CINE)

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>, Andrew Dunstan <andrew@dunslane.net>, Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>, Kjell Rune Skaaraas <kjella79@yahoo.no>, pgsql-hackers@postgresql.org
Date: 2010-04-30T13:42:48Z
Lists: pgsql-hackers
Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
> > We can artificially make this problem as complicated as we wish, but
> > the people who are asking for this feature (including me) will, I
> > believe, be quite happy with a solution that throws, say, a NOTICE
> > instead of an ERROR when the object already exists, and then returns
> > without doing anything further.  There are very few, if any,
> > definitional issues here, except by people who are brainstorming crazy
> > alternative behaviors whose actual usefulness I very much doubt.
> 
> > CREATE OR REPLACE is indeed much more complicated.  In fact, for
> > tables, I maintain that you'll need to link with -ldwim to make it
> > work properly.
> 
> This may in fact be an appropriate way to handle the case for tables,
> given the complexity of their definitions.  However, the original
> point of the thread was about what to do for columns.  I still say
> that COR rather than CINE semantics would be appropriate for columns.

I have added this TODO item:

	Allow CREATE TABLE to optionally create a table if it does not already
	exist, without throwing an error
	
	    The fact that tables contain data makes this more complex than other
	CREATE OR REPLACE operations.
	
	        * http://archives.postgresql.org/pgsql-hackers/2010-04/msg01300.php 

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com