Excerpts from Tom Lane's message of mar feb 15 12:42:00 -0300 2011:
> Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> > pageinspect is just a debugging aid, so I think we should change it from
> > smallint to int4 in 9.1, and not bother backporting.
>
> I don't see any reason that the old version of the function couldn't be
> dropped in the upgrade script. It's not likely anything would be
> depending on it, is it?
Okay, so I changed the C code, and there's working upgrade support that
takes you from the 9.0 version to the 9.1 version.
I tested this by creating a 9.0 database with pageinspect loaded, then
pg_upgrade'd it to 9.1, then rancreate extension pageinspect from unpackaged;
If I run the function before running the CREATE EXTENSION command, it
works but still displays the negative numbers. After that, it behaves
as expected.
I was a bit surprised that I had to remove the ALTER EXTENSION/ADD
FUNCTION command from the upgrade script, but in hindsight it makes
perfect sense -- those commands are being run inside the
"create_extension" context and so the function being created already
belongs to the extension. Still, maybe we should make ALTER
EXTENSION/ADD idempotent.
I considered the idea of calling this version 1.1 and shipping a new
pageinspect--1.0--1.1.sql script (which works perfectly, provided you
run ALTER EXTENSION/DROP FUNCTION before dropping the function, then
ALTER/ADD later), but decided that this was overkill. We can still
change it if people thinks that'd be better, of course, but ...
Nice work on extensions and their upgradability, overall.
--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support