Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TyjF2-0002ga-Kx for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Jan 2013 13:22:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TyjF2-0000zO-5c for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Jan 2013 13:22:48 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TyjF0-0000zJ-Pe for pgsql-hackers@postgreSQL.org; Fri, 25 Jan 2013 13:22:46 +0000 Received: from moutng.kundenserver.de ([212.227.17.8]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TyjEz-00017V-FS for pgsql-hackers@postgreSQL.org; Fri, 25 Jan 2013 13:22:46 +0000 Received: from anarazel.de (p5DDC4573.dip.t-dialin.net [93.220.69.115]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0MKZOx-1TzXvC0toF-001xK9; Fri, 25 Jan 2013 14:22:41 +0100 Received: by anarazel.de (Postfix, from userid 1000) id 6B6531C0177; Fri, 25 Jan 2013 14:22:40 +0100 (CET) Date: Fri, 25 Jan 2013 14:22:40 +0100 From: Andres Freund To: Bruce Momjian Cc: james@illusorystudios.com, PostgreSQL-development Subject: Re: [BUGS] BUG #7515: DROP TABLE IF EXISTS fails if schema does not exist Message-ID: <20130125132240.GE4289@awork2.anarazel.de> References: <20130125014520.GO21914@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130125014520.GO21914@momjian.us> X-Provags-ID: V02:K0:FhtYco62HbFvXqDad8TBOGpukd4EWHrUlN7cYxe0YSF o6aVq3yIbXkT4rtbMacmSQJRV/3tFSFQO1DdskghHzIuYm31Tn rUZJbXvhNihByooYP0JwiVf5I2n9DFl7cakIQWLejJbDGOxUoo TkSkMZdbC3BF17e2TfkpsuDu7WyzFvX08rjB77fBp11tv6GP1D MMlZIwxxSXlN/EBrjHCSqMmmEck/Qhd2CkWqxUDY0Omaemixm+ Ae3m/NGIqwD9a751nnqxyPFzSEODOzpvZGat54PzB1DwgXX80c 76kZVjzxEQeRa0QLssRKHUsUzqMGx5OGI87PaA2SoiHq/VZ5pB T6G23I0AnwcA3Q0HWU7+GxVnYrcWZUmKWfkY01Qsu X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2013-01-24 20:45:20 -0500, Bruce Momjian wrote: > On Sun, Sep 2, 2012 at 05:40:54PM +0000, james@illusorystudios.com wrote: > > The following bug has been logged on the website: > > > > Bug reference: 7515 > > Logged by: James Bellinger > > Email address: james@illusorystudios.com > > PostgreSQL version: 9.1.5 > > Operating system: Ubuntu Linux 12.04 Server > > Description: > > > > If the table being referenced has a schema in its name, and the schema does > > not exist, DROP TABLE IF EXISTS will have an ERROR instead of a NOTICE. > > > > So for instance, > > DROP TABLE IF EXISTS bar; > > This is a NOTICE if bar does not exist. > > > > DROP TABLE IF EXISTS foo.bar; > > This is an ERROR if foo does not exist, even though that implies bar does > > not exist which means it should be a NOTICE. > > > > Saw this because it was making a drop/recreate transaction fail on me, after > > I changed some code to use a schema. > > I looked at this bug report from September. The problem is that > LookupExplicitNamespace() doesn't have a missing_ok parameter, even > though get_namespace_oid(), which it calls, does. By adding a > missing_ok parameter and passing it cleanly, I fixed the problem: > > test=> DROP TABLE IF EXISTS foo.bar; > NOTICE: table "bar" does not exist, skipping > DROP TABLE > > Patch attached. That makes it a HEAD only fix though. I personally don't have a problem with that, but others might... Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers