[postgis-users] ERROR: type "raster" is only a shell
Regina Obe
lr at pcorp.us
Wed Sep 7 15:20:29 PDT 2022
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;
From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Marcelo Marques
Sent: Wednesday, September 7, 2022 5:07 PM
To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
Subject: [postgis-users] ERROR: type "raster" is only a shell
-- Platform:
Windows Server 2019
PostgreSQL 12.12
Postgis 3.2.3
SELECT postgis_full_version();
"POSTGIS=""3.2.3 3.2.3"" [EXTENSION] PGSQL=""120"" GEOS=""3.10.3-CAPI-1.16.1"" PROJ=""7.2.1""
LIBXML=""2.9.9"" LIBJSON=""0.12"" LIBPROTOBUF=""1.2.1"" WAGYU=""0.5.0 (Internal)""
(raster procs from ""2.4.4 r16526"" need upgrade)"
** NOTE: postgis 3.2.3 and raster 2.4.4 **
**-- Upgrade the Postgis Extensions**
SELECT postgis_extensions_upgrade();
NOTICE: Packaging extension postgis_raster
ERROR: type "raster" is only a shell
CONTEXT: SQL statement
"CREATE EXTENSION postgis_raster SCHEMA public VERSION unpackaged;
ALTER EXTENSION postgis_raster UPDATE TO "3.2.3""
PL/pgSQL function postgis_extensions_upgrade() line 71 at EXECUTE
SQL state: 42704
**QUESTIONS:**
Why the extension upgrade returns "ERROR: type "raster" is only a shell" ???
Is this another bug ???
Is there any other workaround for this issue besides "uninstall_rtpostgis.sql" described below ???
**--SOLUTION: **
-- uninstall postgis_raster
psql
\c rev
\i 'C:\\Program Files\\PostgreSQL\\12\\share\\contrib\\postgis-3.2\\uninstall_rtpostgis.sql'
SELECT postgis_extensions_upgrade();
"Upgrade completed, run SELECT postgis_full_version(); for details"
NOTICE: Extension postgis_raster is not available or not packagable for some reason
NOTICE: Extension postgis_sfcgal is not available or not packagable for some reason
NOTICE: Extension postgis_topology is not available or not packagable for some reason
NOTICE: Extension postgis_tiger_geocoder is not available or not packagable for some reason
Successfully run. Total query runtime: 144 msec.
1 rows affected.
SELECT postgis_full_version();
"POSTGIS=""3.2.3 3.2.3"" [EXTENSION] PGSQL=""120"" GEOS=""3.10.3-CAPI-1.16.1"" PROJ=""7.2.1""
LIBXML=""2.9.9"" LIBJSON=""0.12"" LIBPROTOBUF=""1.2.1"" WAGYU=""0.5.0 (Internal)"""
CREATE EXTENSION postgis_raster;
CREATE EXTENSION
Query returned successfully in 227 msec.
SELECT postgis_full_version();
"POSTGIS=""3.2.3 3.2.3"" [EXTENSION] PGSQL=""120"" GEOS=""3.10.3-CAPI-1.16.1"" PROJ=""7.2.1""
GDAL=""GDAL 3.4.3, released 2022/04/22 GDAL_DATA not found""
LIBXML=""2.9.9"" LIBJSON=""0.12"" LIBPROTOBUF=""1.2.1"" WAGYU=""0.5.0 (Internal)"" RASTER"
SELECT * FROM pg_available_extensions WHERE name LIKE 'postgis%';
"name" "default_version" "installed_version" "comment"
"postgis" "3.2.3" "3.2.3" "PostGIS geometry and geography spatial types and functions"
"postgis_raster" "3.2.3" "3.2.3" "PostGIS raster types and functions"
DROP EXTENSION postgis_raster;
DROP EXTENSION
Query returned successfully in 94 msec.
------------------------------------------------------
I appreciate the assistance to clarify my questions.
Thanks,
Marcelo Marques | Principal Product Engineer | Esri - www.esri.com <http://www.esri.com> |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220907/a3e760ed/attachment.htm>
More information about the postgis-users
mailing list