Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TzARk-0004OA-8B for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Jan 2013 18:25:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TzARj-0000po-Ol for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Jan 2013 18:25:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TzARi-0000pf-Dq for pgsql-hackers@postgreSQL.org; Sat, 26 Jan 2013 18:25:42 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TzARg-0000I6-5w for pgsql-hackers@postgreSQL.org; Sat, 26 Jan 2013 18:25:42 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1TzARe-0005I0-RW; Sat, 26 Jan 2013 13:25:38 -0500 Date: Sat, 26 Jan 2013 13:25:38 -0500 From: Bruce Momjian To: james@illusorystudios.com Cc: PostgreSQL-development Subject: Re: Re: [BUGS] BUG #7515: DROP TABLE IF EXISTS fails if schema does not exist Message-ID: <20130126182538.GC9274@momjian.us> 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> User-Agent: Mutt/1.5.20 (2009-06-14) 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 Thu, Jan 24, 2013 at 08:45:20PM -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. Patch applied to git head. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers