Re: Chatter on DROP SOMETHING IF EXISTS

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Chatter on DROP SOMETHING IF EXISTS
Date: 2007-02-18 02:02:33
Message-ID: 200702180202.l1I22Xc13630@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> "Jim C. Nasby" <jim(at)nasby(dot)net> writes:
> > On Thu, Feb 08, 2007 at 01:54:13PM -0500, Tom Lane wrote:
> >> I would be satisfied if the returned command tag were something else,
> >> maybe "NO OPERATION".
>
> > "TABLE blah DID NOT EXIST" might be less confusing...
>
> You're confusing a command tag with a notice. In the first place,
> we shouldn't assume that applications are ready to deal with
> indefinitely long command tags (the backend itself doesn't think they
> can be longer than 64 bytes); in the second place, they should be
> constant strings for the most part so that simple strcmp()s suffice
> to see what happened. Command tags are meant for programs to deal
> with, more than humans.

Yep. Because IF EXISTS is in a lot of object destruction commands,
adding a modified tag seems very confusing, because in fact the DROP
TABLE did succeed, so to give any other tag seems incorrect.

I think the only option would be to use INFO instead of NOTICE, but
because the output is optional based on whether the object exists, you
might say NOTICE is the right level.

I am afraid we might just need to live with the current behavior.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Kahwe Smith 2007-02-18 02:02:46 Re: Plan invalidation design
Previous Message Bruce Momjian 2007-02-18 01:35:21 Re: [HACKERS] Dead code in _bt_split?