On Sat, Jun 30, 2012 at 01:00:07AM -0400, Bruce Momjian wrote:
> On Fri, Jun 29, 2012 at 11:35:15PM -0400, Tom Lane wrote:
> > Bruce Momjian <br...@momjian.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.  

FYI, I forgot to mention that there is a unique index on extname, so
testing just for the name should work fine.

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to