[postgis-tickets] [PostGIS] #5236: ERROR: type "raster" is only a shell

PostGIS trac at osgeo.org
Wed Sep 7 17:08:39 PDT 2022


#5236: ERROR:  type "raster" is only a shell
-----------------------+----------------------------
  Reporter:  marc3932  |      Owner:  pramsey
      Type:  defect    |     Status:  new
  Priority:  medium    |  Milestone:  PostGIS 3.2.4
 Component:  postgis   |    Version:  3.2.x
Resolution:            |   Keywords:  postgis_raster
-----------------------+----------------------------
Comment (by marc3932):

 Reply from Regina Obe

 The below ERROR:  type "raster" is only a shell is usually not an error
 but a NOTICE that tells you the raster type has not been defined yet.  It
 happens when functions using the raster type are created before the raster
 type is created.  As long as the raster type is created before the install
 is complete, then it does not error, and might show as a NOTICE.

 The fact it shows as an error in your case

 Suggests to me, 3 possible scenarios

 a) You managed to get yourself into a state where you have no raster type,
 which should be impossible if you are doing an upgrade of raster, unless
 you did some Frankenstein surgery on your raster, as people often do when
 they panic and see the “Raster is unpackaged” message and start deleting
 stuff randomly.

 Like with a command

 {{{
 DROP TYPE raster CASCADE;
 }}}


 If this is the scenario you have, you’ve already destroyed any raster data
 you had, so best course of action is still

 -- uninstall postgis_raster

 {{{
 psql
 \c rev
 \i 'C:\\Program
 Files\\PostgreSQL\\12\\share\\contrib\\postgis-3.2\\uninstall_rtpostgis.sql'
 }}}

 b)  You did this when you actually had no postgis_raster installed at all.

 {{{
 CREATE EXTENSION postgis_raster SCHEMA public VERSION unpackaged;

 }}}

 And then Trying to do below after a rasterless raster extension I would
 expect to fail with the above notice – this is what
 postgis_extensions_upgrade() would be doing internally

 {{{
 ALTER EXTENSION postgis_raster UPDATE TO "3.2.3""
 }}}

 This is a fake install, and can be dropped with

 {{{
 DROP EXTENSION postgis_raster;
 }}}

 but the fact you showed (raster procs from ""2.4.4 r16526"" need upgrade)"
 suggests this is not the case, and you are more likely facing a) or c)

 c) You installed raster in a separate schema from postgis, this again I
 can’t imagine how this is possible, unless you started

 with a postgis install from 2.4.4, using scripts instead of the extension
 system and then you decided to run postgis.sql in one schema and
 rtpostgis.sql in a separate schema.

 And then you proceeded to then convert to an extensions based install.

 In a regular extension install, both postgis.sql and rtpostgis.sql are
 packaged together, so having them somehow end up in different schemas
 would be I think impossible, though I would be impressed if someone could
 prove me wrong.

 Assuming you did an extensionless install, putting raster and postgis in
 separate schemas

 The fix (not tested) would be:

 Figure out which schema you have raster installed in, and make sure you do
 your unpackaged install in the same schema as follows:

 {{{
 CREATE EXTENSION postgis_raster SCHEMA <the schema it is installed in
 here> VERSION unpackaged;

 ALTER EXTENSION postgis_raster UPDATE;
 }}}

 -- this part you need to do because postgis_raster is no longer
 relocatable, and we require both postgis and postgis_raster to reside in
 the same schema.

 -- allow you to move it

 {{{
 UPDATE pg_extension SET extrelocatable = true WHERE extname
 ='postgis_raster';
 }}}

 -- move it

 {{{
 ALTER EXTENSION postgis_raster SET SCHEMA <where the postgis extension is
 installed>;
 }}}

 -- at this point many of your raster functions are broken cause they are
 pointing at the old schema, this fixes that mess

 {{{
 ALTER EXTENSION postgis_raster UPDATE;
 }}}
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5236#comment:2>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list