Re: [HACKERS] Add column if not exists (CINE)

2010-07-25 Thread Robert Haas
On Fri, Jul 23, 2010 at 2:46 AM, Bernd Helmle maili...@oopsware.de wrote: Yes, i agree. I would like to mark this patch Ready for Committer, if that's okay for you (since you are a committer you might want to commit it yourself). I see that it is so marked, so, committed, with a minor

Re: [HACKERS] Add column if not exists (CINE)

2010-07-25 Thread Robert Haas
On Thu, Jul 22, 2010 at 4:34 PM, Kjell Rune Skaaraas kjell...@yahoo.no wrote: At least from a performance point of view CINE should never cause a table rewrite, it should either execute as a plain CREATE or as nothing. I don't mind if the CINE fails if the column already exists but with a

Re: [HACKERS] Add column if not exists (CINE)

2010-07-23 Thread Bernd Helmle
--On 21. Juli 2010 17:16:13 -0400 Robert Haas robertmh...@gmail.com wrote: I get the same error message from concurrent CREATE TABLE commands even without CINE... S1: rhaas=# begin; BEGIN rhaas=# create table foo (id int); CREATE TABLE S2: rhaas=# begin; BEGIN rhaas=# create table foo (id

Re: [HACKERS] Add column if not exists (CINE)

2010-07-23 Thread Robert Haas
On Fri, Jul 23, 2010 at 2:46 AM, Bernd Helmle maili...@oopsware.de wrote: --On 21. Juli 2010 17:16:13 -0400 Robert Haas robertmh...@gmail.com wrote: I get the same error message from concurrent CREATE TABLE commands even without CINE... S1: rhaas=# begin; BEGIN rhaas=# create table foo

Re: [HACKERS] Add column if not exists (CINE)

2010-07-22 Thread Kjell Rune Skaaraas
, Kjell Rune --- Den tor 2010-07-22 skrev Simon Riggs si...@2ndquadrant.com: Fra: Simon Riggs si...@2ndquadrant.com Emne: Re: [HACKERS] Add column if not exists (CINE) Til: Tom Lane t...@sss.pgh.pa.us Kopi: Robert Haas robertmh...@gmail.com, Heikki Linnakangas heikki.linnakan

Re: [HACKERS] Add column if not exists (CINE)

2010-07-21 Thread Bernd Helmle
--On 1. Mai 2010 23:09:23 -0400 Robert Haas robertmh...@gmail.com wrote: On Wed, Apr 28, 2010 at 9:15 PM, Tom Lane t...@sss.pgh.pa.us wrote: 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.

Re: [HACKERS] Add column if not exists (CINE)

2010-07-21 Thread Robert Haas
On Wed, Jul 21, 2010 at 2:53 PM, Bernd Helmle maili...@oopsware.de wrote: --On 1. Mai 2010 23:09:23 -0400 Robert Haas robertmh...@gmail.com wrote: On Wed, Apr 28, 2010 at 9:15 PM, Tom Lane t...@sss.pgh.pa.us wrote: CREATE OR REPLACE is indeed much more complicated.  In fact, for tables, I

Re: [HACKERS] Add column if not exists (CINE)

2010-07-21 Thread Simon Riggs
On Wed, 2010-04-28 at 21:15 -0400, Tom Lane wrote: I still say that COR rather than CINE semantics would be appropriate for columns. Viewed from a locking perspective, I would disagree. COR semantics force a table rewrite, in certain cases. That makes it hard to predict externally how long

Re: [HACKERS] Add column if not exists (CINE)

2010-05-01 Thread Robert Haas
On Sat, May 1, 2010 at 2:26 PM, Kjell Rune Skaaraas kjell...@yahoo.no wrote: In other words, pretty much all the hard bits I seem to hear people agree on exist still apply to the single column. COR for columns was suggested already back in the same thread in 2005:

Re: [HACKERS] Add column if not exists (CINE)

2010-05-01 Thread Robert Haas
On Wed, Apr 28, 2010 at 9:15 PM, Tom Lane t...@sss.pgh.pa.us wrote: 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

Re: [HACKERS] Add column if not exists (CINE)

2010-05-01 Thread Kjell Rune Skaaraas
--- Den fre 2010-04-30 skrev Bruce Momjian br...@momjian.us: Tom Lane wrote: Robert Haas robertmh...@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

Re: [HACKERS] Add column if not exists (CINE)

2010-04-30 Thread Bruce Momjian
Tom Lane wrote: Robert Haas robertmh...@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

Re: [HACKERS] Add column if not exists (CINE)

2010-04-29 Thread Chris Browne
robertmh...@gmail.com (Robert Haas) writes: On Wed, Apr 28, 2010 at 1:40 PM, Dimitri Fontaine dfonta...@hi-media.com wrote: Robert Haas robertmh...@gmail.com writes: Well, how would you define CREATE OR REPLACE TABLE?  I think that doesn't make much sense, which is why I think CREATE IF NOT

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Andrew Dunstan
Takahiro Itagaki wrote: Kjell Rune Skaaraas kjell...@yahoo.no wrote: I've been reading the earlier threads at: http://archives.postgresql.org/pgsql-hackers/2009-05/thrd7.php#00252 http://archives.postgresql.org/pgsql-hackers/2005-10/thrd4.php#00632 and I'm not sure I have anything that

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: Takahiro Itagaki wrote: But before developing, we need to decide how to handle an added object that has the same name but has different definitions. The OP explicitly stated that in his opinion nothing should be done in such cases. That's a

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Ross J. Reedstrom
On Tue, Apr 27, 2010 at 08:18:13PM -0400, Robert Haas wrote: On Tue, Apr 27, 2010 at 6:45 PM, Kjell Rune Skaaraas kjell...@yahoo.no wrote: [snip] I saw some indications that this might be a minority opinion, well I would like to cast a vote FOR this functionality. The workarounds are ugly,

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Robert Haas
On Wed, Apr 28, 2010 at 9:58 AM, Tom Lane t...@sss.pgh.pa.us wrote: Andrew Dunstan and...@dunslane.net writes: Takahiro Itagaki wrote: But before developing, we need to decide how to handle an added object that has the same name but has different definitions. The OP explicitly stated that in

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: I don't believe you are fairly stating the consensus from previous discussion and I believe that you are actually in the minority on this one. I agree that we probably don't need to support this for object types for which CREATE OR REPLACE is

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Heikki Linnakangas
Tom Lane wrote: Robert Haas robertmh...@gmail.com writes: I don't believe you are fairly stating the consensus from previous discussion and I believe that you are actually in the minority on this one. I agree that we probably don't need to support this for object types for which CREATE OR

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Robert Haas
On Wed, Apr 28, 2010 at 11:20 AM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: I don't believe you are fairly stating the consensus from previous discussion and I believe that you are actually in the minority on this one.  I agree that we probably don't need to

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Heikki Linnakangas
Robert Haas wrote: On Wed, Apr 28, 2010 at 11:20 AM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: I don't believe you are fairly stating the consensus from previous discussion and I believe that you are actually in the minority on this one. I agree that we

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Andrew Dunstan
Robert Haas wrote: On Wed, Apr 28, 2010 at 11:20 AM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: I don't believe you are fairly stating the consensus from previous discussion and I believe that you are actually in the minority on this one. I agree

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: Actually, that's a good idea. But how will you handle tables? Well, tables are a special case, mainly because it's not clear how to avoid accidentally throwing away data. (In particular if some column in the existing table isn't there in the new

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Robert Haas
On Wed, Apr 28, 2010 at 12:07 PM, Heikki Linnakangas heikki.linnakan...@enterprisedb.com wrote: Robert Haas wrote: On Wed, Apr 28, 2010 at 11:20 AM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: I don't believe you are fairly stating the consensus from previous

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Robert Haas
On Wed, Apr 28, 2010 at 1:40 PM, Dimitri Fontaine dfonta...@hi-media.com wrote: Robert Haas robertmh...@gmail.com writes: Well, how would you define CREATE OR REPLACE TABLE?  I think that doesn't make much sense, which is why I think CREATE IF NOT EXISTS is a reasonable approach. hand waving

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Dimitri Fontaine
Robert Haas robertmh...@gmail.com writes: Well, how would you define CREATE OR REPLACE TABLE? I think that doesn't make much sense, which is why I think CREATE IF NOT EXISTS is a reasonable approach. hand waving time The behavior I'd like to have would be to allow me to give a SELECT query

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Heikki Linnakangas
Robert Haas wrote: On Wed, Apr 28, 2010 at 12:07 PM, Heikki Linnakangas heikki.linnakan...@enterprisedb.com wrote: Robert Haas wrote: On Wed, Apr 28, 2010 at 11:20 AM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: I don't believe you are fairly stating the

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Kjell Rune Skaaraas
--- Den ons 2010-04-28 skrev Tom Lane t...@sss.pgh.pa.us: Fra: Tom Lane t...@sss.pgh.pa.us Emne: Re: [HACKERS] Add column if not exists (CINE) Til: Robert Haas robertmh...@gmail.com Kopi: Andrew Dunstan and...@dunslane.net, Takahiro Itagaki itagaki.takah...@oss.ntt.co.jp, Kjell Rune

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Tom Lane
Heikki Linnakangas heikki.linnakan...@enterprisedb.com writes: Robert Haas wrote: Well, how would you define CREATE OR REPLACE TABLE? It the table doesn't exist, create it. If it exists with the same name and same columns and constraints and all, do nothing. Otherwise throw an error. Maybe

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Robert Haas
On Wed, Apr 28, 2010 at 2:57 PM, Tom Lane t...@sss.pgh.pa.us wrote: Heikki Linnakangas heikki.linnakan...@enterprisedb.com writes: Robert Haas wrote: Well, how would you define CREATE OR REPLACE TABLE? It the table doesn't exist, create it. If it exists with the same name and same columns

Re: [HACKERS] Add column if not exists (CINE)

2010-04-28 Thread Tom Lane
Robert Haas robertmh...@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

Re: [HACKERS] Add column if not exists (CINE)

2010-04-27 Thread Robert Haas
On Tue, Apr 27, 2010 at 6:45 PM, Kjell Rune Skaaraas kjell...@yahoo.no wrote: Hello, I've been reading the earlier threads at: http://archives.postgresql.org/pgsql-hackers/2009-05/thrd7.php#00252 http://archives.postgresql.org/pgsql-hackers/2005-10/thrd4.php#00632 and I'm not sure I have

Re: [HACKERS] Add column if not exists (CINE)

2010-04-27 Thread Takahiro Itagaki
Kjell Rune Skaaraas kjell...@yahoo.no wrote: I've been reading the earlier threads at: http://archives.postgresql.org/pgsql-hackers/2009-05/thrd7.php#00252 http://archives.postgresql.org/pgsql-hackers/2005-10/thrd4.php#00632 and I'm not sure I have anything that substantially new to add but: