From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: m.sakrejda@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6706: pg_upgrade fails when plpgsql dropped/re-created
Date: Mon, 2 Jul 2012 13:28:36 -0400
Message-ID: <20120702172836.GB25966@momjian.us> (raw)
In-Reply-To: <19241.1341248511@sss.pgh.pa.us>
References: <E1SjIEG-0007Xu-PW@wrigleys.postgresql.org>
<20120630015430.GA912@momjian.us>
<336.1341027315@sss.pgh.pa.us>
<20120630050007.GA20759@momjian.us>
<11221.1341069176@sss.pgh.pa.us>
<20120630162858.GC20759@momjian.us>
<14513.1341081467@sss.pgh.pa.us>
<20120702154211.GA25966@momjian.us>
<19241.1341248511@sss.pgh.pa.us>
On Mon, Jul 02, 2012 at 01:01:51PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > +
> > + /*
> > + * We unconditionally create the extension, so we must drop it if it
> > + * exists. This could happen if the user deleted 'plpgsql' and then
> > + * readded it, causing its oid to be greater than FirstNormalObjectId.
> > + */
> > + appendPQExpBuffer(q, "DROP EXTENSION IF EXISTS %s;\n", qextname);
>
> This doesn't seem like anything but a wart :-(. It's unlike the
> behavior for every other kind of object, it introduces the inconsistent
Well, our use of FirstNormalObjectId by pg_dump for extensions is unique
too.
> behavior even in non-binary-upgrade cases, and it does nothing at all to
This code is in the binary-upgrade block --- not sure how it could
affect non-binary upgrades.
This is the trimmed-down code block:
if (!binary_upgrade)
{
appendPQExpBuffer(q, "CREATE EXTENSION IF NOT EXISTS %s WITH SCHEMA %s;\n",
qextname, fmtId(extinfo->namespace));
}
else
{
--> appendPQExpBuffer(q, "DROP EXTENSION IF EXISTS %s;\n", qextname);
appendPQExpBuffer(q,
"SELECT binary_upgrade.create_empty_extension(");
The idea is that the IF NOT EXISTS and IF EXISTS are symmetric, which is
my goal.
> address the points I made about reproducing the previous state in cases
> where the admin removed the language or changed its permissions.
Well, it still does the create extension in binary mode like before ---
not sure what the problem is.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
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, tgl@sss.pgh.pa.us, m.sakrejda@gmail.com
Subject: Re: BUG #6706: pg_upgrade fails when plpgsql dropped/re-created
In-Reply-To: <20120702172836.GB25966@momjian.us>
References: <E1SjIEG-0007Xu-PW@wrigleys.postgresql.org> <20120630015430.GA912@momjian.us> <336.1341027315@sss.pgh.pa.us> <20120630050007.GA20759@momjian.us> <11221.1341069176@sss.pgh.pa.us> <20120630162858.GC20759@momjian.us> <14513.1341081467@sss.pgh.pa.us> <20120702154211.GA25966@momjian.us> <19241.1341248511@sss.pgh.pa.us> <20120702172836.GB25966@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