Skip site navigation (1) Skip section navigation (2)

Re: [PATCH] Return command tag 'REPLACE X' for CREATE OR REPLACE statements.

From: David Fetter <david(at)fetter(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Marti Raudsepp <marti(at)juffo(dot)org>,KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>,pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Return command tag 'REPLACE X' for CREATE OR REPLACE statements.
Date: 2011-01-17 19:35:23
Message-ID: 20110117193523.GD18561@fetter.org (view raw or flat)
Thread:
Lists: pgsql-hackers
On Mon, Jan 17, 2011 at 09:23:07PM +0200, Peter Eisentraut wrote:
> On mån, 2011-01-17 at 10:05 -0500, Robert Haas wrote:
> > On Mon, Jan 17, 2011 at 9:41 AM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> > > On fre, 2011-01-14 at 18:45 -0500, Robert Haas wrote:
> > >> On Fri, Jan 14, 2011 at 3:45 PM, Marti Raudsepp <marti(at)juffo(dot)org>
> > >> wrote:
> > >> > There's a similar case with CREATE TABLE IF NOT EXISTS, maybe this
> > >> is
> > >> > worth covering in an updated patch too?
> > >> > And if I change that, people might expect the same from DROP X IF
> > >> EXISTS too?
> > >>
> > >> It's far less clear what you'd change those cases to say, and they
> > >> already emit a NOTICE, so it seems unnecessary.
> > >
> > > Maybe instead of the proposed patch, a notice could be added:
> > >
> > > NOTICE: existing object was replaced
> > 
> > Well, that would eliminate the backward-compatibility hazard, pretty
> > much, but it seems noisy.  I already find some of these notices to be
> > unduly informative.
> 
> I'm also anti-NOTICE.
> 
> I'm just saying, we propose that CREATE OR REPLACE should return a tag
> of CREATE or REPLACE depending on what it did, then DROP IF NOT EXISTS
> should also return a tag of DROP or ??? depending on what it did.  Since
> the latter question was settled by a notice, that would also be the
> proper answer for the former.
> 
> Perhaps the next thing is that MERGE should return INSERT or UPDATE
> depending on the outcome?

Given that it can do both in a single statement, I'm guessing that
this is intended to be facetious.  Or are you suggesting that the
command tags become an array?  This has all kinds of interesting
possibilities, but would of course break all kinds of stuff in the
process.

Cheers,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2011-01-17 19:46:33
Subject: Re: We need to log aborted autovacuums
Previous:From: Magnus HaganderDate: 2011-01-17 19:32:33
Subject: Re: pg_basebackup for streaming base backups

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group