pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Cc: Peter Eisentraut <peter_e@gmx.net>
Subject: Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist
Date: Mon, 2 Dec 2013 16:37:18 -0300
Message-ID: <20131202193718.GC5731@eldon.alvh.no-ip.org> (raw)
In-Reply-To: <CAEZATCVbjDhoTFbKY1+O_Rdt=gs=7GpKVUpKBbZKK0aZCW1agA@mail.gmail.com>
References: <CAFj8pRBtY8ayyVYKLhSFJHL68-QdDJxFAFQ_Cm7H+3AN663RnQ@mail.gmail.com>
	<528E85B9.2070200@gmx.net>
	<CAFj8pRBg8i6HP6Uv_sPOihzS7Xy6DdgfFOnbLThys46v3gtgFg@mail.gmail.com>
	<5294FC63.2090401@gmx.net>
	<CAEZATCVZS6PdAOgb5Fuv8moNi4krj4MNigPDB5JfLF08tx4GZw@mail.gmail.com>
	<CAFj8pRAY-29cuAVKauq=4_martW4H1UHG986MuHqTG++ZY_OtQ@mail.gmail.com>
	<1385845631.27340.22.camel@vanquo.pezone.net>
	<CAFj8pRA7Vx5qzzNZX=e=aW49x7-V_shmX=3qemfw4Ogbz5cF7A@mail.gmail.com>
	<CAFj8pRDUAj1C_DdQRbi1zTMGe5v9xax8hLUQiVicnxf6PhYN9w@mail.gmail.com>
	<CAEZATCVbjDhoTFbKY1+O_Rdt=gs=7GpKVUpKBbZKK0aZCW1agA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Dean Rasheed escribió:

> +/*
> + * If a schema was explicitly specified, test if it exists.  If it does not,
> + * report the schema as missing rather than the child object.
> + */
> +static bool
> +schema_does_not_exist_skipping(List *objname,
> +							   const char **msg,
> +							   char **name)
> +{
> +	RangeVar	*rel;
> +
> +	rel = makeRangeVarFromNameList(objname);
> +
> +	if (rel->schemaname != NULL &&
> +		!OidIsValid(LookupNamespaceNoError(rel->schemaname)))
> +	{
> +		*msg = gettext_noop("schema \"%s\" does not exist, skipping");
> +		*name = rel->schemaname;
> +
> +		return true;
> +	}
> +
> +	return false;
> +}

In success cases, are we leaking a lot of memory?  In the error case I
guess it doesn't matter that the RangeVar is getting leaked (we're
aborting anyway), but if we're called and everything turns out to work,
are things cleaned up timely?

-- 
Álvaro Herrera                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



view thread (83+ messages)  latest in thread

Message-ID: <20131202193718.GC5731@eldon.alvh.no-ip.org>
Permalink:  ../20131202193718.GC5731@eldon.alvh.no-ip.org/
Also on:    postgresql.org/message-id/20131202193718.GC5731@eldon.alvh.no-ip.org

 · 

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: alvherre@2ndquadrant.com, dean.a.rasheed@gmail.com, pavel.stehule@gmail.com, pgsql-hackers@postgresql.org, peter_e@gmx.net
  Subject: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist
  In-Reply-To: <20131202193718.GC5731@eldon.alvh.no-ip.org>
  References: <CAFj8pRBtY8ayyVYKLhSFJHL68-QdDJxFAFQ_Cm7H+3AN663RnQ@mail.gmail.com> <528E85B9.2070200@gmx.net> <CAFj8pRBg8i6HP6Uv_sPOihzS7Xy6DdgfFOnbLThys46v3gtgFg@mail.gmail.com> <5294FC63.2090401@gmx.net> <CAEZATCVZS6PdAOgb5Fuv8moNi4krj4MNigPDB5JfLF08tx4GZw@mail.gmail.com> <CAFj8pRAY-29cuAVKauq=4_martW4H1UHG986MuHqTG++ZY_OtQ@mail.gmail.com> <1385845631.27340.22.camel@vanquo.pezone.net> <CAFj8pRA7Vx5qzzNZX=e=aW49x7-V_shmX=3qemfw4Ogbz5cF7A@mail.gmail.com> <CAFj8pRDUAj1C_DdQRbi1zTMGe5v9xax8hLUQiVicnxf6PhYN9w@mail.gmail.com> <CAEZATCVbjDhoTFbKY1+O_Rdt=gs=7GpKVUpKBbZKK0aZCW1agA@mail.gmail.com> <20131202193718.GC5731@eldon.alvh.no-ip.org>

* 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