Re: BUG #6706: pg_upgrade fails when plpgsql dropped/re-created

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: m(dot)sakrejda(at)gmail(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6706: pg_upgrade fails when plpgsql dropped/re-created
Date: 2012-06-30 05:00:07
Message-ID: 20120630050007.GA20759@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Jun 29, 2012 at 11:35:15PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > I can't think of how to fix this. Perhaps we need to query the
> > pg_extension table as of the SELECT function all.
>
> I think you're misjudging the core of the issue. The same thing
> would happen if somebody dropped and recreated the public schema.
> Or anything else that we create at initdb time but allow to be
> dropped.

I just tested dropping and recreating the 'public' schema and pg_upgrade
worked fine.

I think the fix we need for extensions is to change:

SELECT binary_upgrade.create_empty_extension('plpgsql',
'pg_catalog', false, '1.0', NULL, NULL,
ARRAY[]::pg_catalog.text[]);

to

SELECT binary_upgrade.create_empty_extension('plpgsql',
'pg_catalog', false, '1.0', NULL, NULL, ARRAY[]::pg_catalog.text[])
WHERE (SELECT COUNT(*) FROM pg_extension WHERE extname = 'plpgsql') = 0;

This basically conditionally calls
binary_upgrade.create_empty_extension() based on whether the extension
already exists in the new cluster.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2012-06-30 05:08:51 Re: BUG #6706: pg_upgrade fails when plpgsql dropped/re-created
Previous Message Tom Lane 2012-06-30 03:35:15 Re: BUG #6706: pg_upgrade fails when plpgsql dropped/re-created