pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: james@illusorystudios.com
Cc: PostgreSQL-development <pgsql-hackers@postgreSQL.org>
Subject: Re: Re: [BUGS] BUG #7515: DROP TABLE IF EXISTS fails if schema does not exist
Date: Sat, 26 Jan 2013 13:25:38 -0500
Message-ID: <20130126182538.GC9274@momjian.us> (raw)
In-Reply-To: <20130125014520.GO21914@momjian.us>
References: <E1T8EAI-0006kH-Ro@wrigleys.postgresql.org>
	<20130125014520.GO21914@momjian.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

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  <bruce@momjian.us>        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



view thread (6+ messages)

Message-ID: <20130126182538.GC9274@momjian.us>
Permalink:  ../20130126182538.GC9274@momjian.us/
Also on:    postgresql.org/message-id/20130126182538.GC9274@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: bruce@momjian.us, james@illusorystudios.com, pgsql-hackers@postgreSQL.org
  Subject: Re: [BUGS] BUG #7515: DROP TABLE IF EXISTS fails if schema does not exist
  In-Reply-To: <20130126182538.GC9274@momjian.us>
  References: <E1T8EAI-0006kH-Ro@wrigleys.postgresql.org> <20130125014520.GO21914@momjian.us> <20130126182538.GC9274@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox