Opened 11 years ago

Closed 10 years ago

#2673 closed defect (fixed)

Can't upgrade from postgis 2.0.4 to postgis 2.2.0

Reported by: robe Owned by: robe
Priority: blocker Milestone: PostGIS 2.2.0
Component: raster Version: master
Keywords: Cc:

Description

When doing on a 2.0.4 database

ALTER EXTENSION postgis
  UPDATE TO "2.2.0dev";

Get this error:

ERROR: cannot drop function _st_mapalgebraunionfinal1(raster_ because other objects depend on it

DETAIL: extension postgis depends on function _st_mapalgebra4unionfinal1(raster)

Change History (9)

comment:1 by robe, 11 years ago

Owner: changed from dustymugs to robe

comment:2 by robe, 11 years ago

hmm I think this might be fixed. Have to retest.

comment:3 by strk, 10 years ago

It is not fixed yet. How to reproduce:

cd raster && make check RUNTESTFLAGS='--extension --upgrade-path=2.0.5--2.2.0dev'                

comment:4 by strk, 10 years ago

This is in rtpostgis_drop.sql.in:

DROP FUNCTION IF EXISTS _st_mapalgebra4unionfinal1(raster);                     

But it is not converted into an "ALTER EXTENSION..DROP". Not sure if it should, and how, as I see the extension/postgis/Makefile.in is doing some of those conversions "manually" (which I hate).

Regina: should there be a script to automatically convert DROP calls to ALTER EXTESION DROP ?

comment:5 by strk, 10 years ago

I've tried to force calling postgis_extension_drop_if_exists for the function, and also added debugging prints in that function. Here's what i got:

pgt=# SELECT postgis_extension_drop_if_exists('postgis', 'DROP FUNCTION IF EXISTS _st_mapalgebra4unionfinal1(raster)'); DROP FUNCTION IF EXISTS _st_mapalgebra4unionfinal1(raster);
NOTICE:  Got function _st_mapalgebra4unionfinal1(raster) is not a member of extension "postgis" (55000)
 postgis_extension_drop_if_exists 
----------------------------------
 f
(1 row)

ERROR:  cannot drop function _st_mapalgebra4unionfinal1(raster) because other objects depend on it
DETAIL:  extension postgis depends on function _st_mapalgebra4unionfinal1(raster)
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

Pretty puzzling, isn't it ? According to ALTER EXTENSION DROP the function is not part of the extension, but according to DROP FUNCTION the postgis extension depends on it.

I guess it's a dependency of some other object that ultimately is part of the extension ? An order-dependent issue ?

Looking further…

comment:6 by strk, 10 years ago

Alright, there are 4 "st_union" functions that are all dependent on this '_st_mapalgebra4unionfinal1(raster)'. They are:

pgt=# select pg_describe_object(1255, oid, 0) from pg_proc where oid in ( select objid from pg_depend where refobjid = '_st_mapalgebra4unionfinal1(raster)'::regprocedure ); 
           pg_describe_object           
----------------------------------------
 function st_union(raster,text)
 function st_union(raster,integer)
 function st_union(raster)
 function st_union(raster,integer,text)
(4 rows)

comment:7 by strk, 10 years ago

It turns out this is a problem with DROP order. We're putting both "rtpostgis_upgrade_cleanup.sql" and "rtpostgis_drop.sql" before rtpostgis_upgrade, so at time of DROP FUNCTION the function is still needed by an aggregate that changed definition.

We have to go back to have a drop_before and a drop_after.

comment:8 by strk, 10 years ago

Uhm, it turns out this was already fixed in the 2.1 branch with r12594, dunno why it wasn't forw-ported

comment:9 by strk, 10 years ago

Resolution: fixed
Status: newclosed

Fixed in trunk (2.2.0) with r12765

Now this works for me:

make check RUNTESTFLAGS='-v --extension --upgrade-path=2.0.5--2.2.0dev'
Note: See TracTickets for help on using tickets.