geometry, with no CRS in parentheses, does not check the Spatial Reference Identifier (SRID) of the values written to it, and an Apache Iceberg engine outside Wherobots reads it as a binary column. A column created as geometry(<srid>) rejects values in the wrong Coordinate Reference System (CRS) and is readable as geometry by other engines that support geospatial types. See Geometry Support in Havasu for how those columns work.
Tables that have not been upgraded keep working. Reads, spatial filter push-down, and every
ST_ function behave the same on them.org_catalog throughout this page is an example catalog name. Replace it with the name of the catalog you are writing to.Upgrade a table
Check whether the table needs upgrading
DESCRIBE TABLE shows geometry for both kinds of column, so it does not tell them apart.Check which SRIDs the column holds
geometry(<srid>) column cannot. What comes back decides both the CRS you declare in the next step and the expression you copy with in the step after it:ST_SetSRID relabels without touching the coordinates. Applying it to metre coordinates declares them as longitude and latitude, which puts the data in the wrong place. SRID 0 rows carry no CRS, so ST_Transform has nothing to reproject them from and fails on them: look at their coordinates to find out which CRS they are in before you label them.Create the new table
Use the CRS from the previous step. This example assumes longitude and latitude.The
SHOW CREATE TABLE output from step 1 shows the partitioning and table properties of the source table. Carry them over to the new statement.Copy the rows
When every row is SRID When the column mixes SRID 0 rows that are longitude and latitude with rows in other SRIDs, reproject the rows that carry an SRID and label all of them:
4326 or 0 and the coordinates are longitude and latitude:Compare the tables and switch over
CREATE SPATIAL INDEX on the new table as described in Cluster by Geospatial Fields for Faster Queries. Drop the source table once nothing reads from it.Error: Cannot write geometry with SRID ...
Error: Cannot write geometry with SRID ...
A copied value disagrees with the CRS of the new column, which means the copy expression does not cover every SRID the source holds. Go back to the SRID check and pick the expression for that result.
Related pages
Geometry Support in Havasu
Creating, writing, updating, and querying geometry tables.
Cluster by Geospatial Fields
Spatial filter push-down and the full
CREATE SPATIAL INDEX syntax.
