Re: Truncate if exists

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Truncate if exists
Date: 2012-10-12 19:27:13
Message-ID: 20121012192713.GQ29165@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Josh Berkus (josh(at)agliodbs(dot)com) wrote:
> On 10/9/12 1:35 PM, Peter Eisentraut wrote:
> > On 10/9/12 5:09 AM, Simon Riggs wrote:
> >> Anyone want to check for any other missing IF EXISTS capability in other DDL?
> >
> > TRUNCATE is not really DDL. If we allow TRUNCATE IF EXISTS, what is
> > stopping someone from requesting DELETE IF EXISTS or INSERT IF EXISTS next?
>
> That's a very good point. I tend to think of all utility commands as
> DDL, which of course they're not.

I don't actually see why that's, inherently, a bad idea. Nor do I see
why IF EXISTS should only apply to DDL and not to all commands.

Obviously, if you write 'IF EXISTS', you've got a plan to deal with the
fact that it doesn't exist. In a lossy system that's using partitions,
I could actually see a pretty good use-case for wanting INSERT IF
EXISTS (rather than having to constantly poll, waiting for the partition
table that's supposted to be created by some other process to show up).

Thanks,

Stephen

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2012-10-12 19:27:46 Re: enhanced error fields
Previous Message Alvaro Herrera 2012-10-12 19:23:12 Re: Truncate if exists