Skip to main content
Since September 15, 2026, a WherobotsDB table declares the Coordinate Reference System (CRS) of a geometry column in the column type, such as GEOMETRY(4326). Tables you created before that date were created at Apache Iceberg format-version 2 and have geometry columns with no declared CRS, and so do tables created from the result of an ST_ function, as described in Tables created from a query. If you own such a table, this page shows how to check it and copy it into a table with a declared CRS. A geometry column created as 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 CRS and is readable as geometry by other engines that support geospatial types. See Geometry and Geography Tables for how those columns work.
Tables you haven’t upgraded stay readable and writable. Reads, writes, and every ST_ function behave the same on them. Spatial filters on their geometry columns skip data files while the table is format-version 2. In a format-version 3 table, such as one created from a query since September 15, 2026, they read every data file. Wherobots plans to retire this column format; the changelog will announce the date.
There is no in-place conversion. ALTER TABLE ... ALTER COLUMN cannot add a CRS to an existing geometry column:
Raising the format version in place with ALTER TABLE ... SET TBLPROPERTIES ('format-version'='3') is not an upgrade either. The existing geometry column keeps no declared CRS, and data files written after the change carry no spatial bounds for that column, so spatial filters on it can no longer skip the new files.Upgrading is create-and-copy.
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

A column with no declared CRS can hold more than one SRID; a 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:Currently, a GEOMETRY(<srid>) column can declare SRID 0, 3857, or 4326, and a GEOGRAPHY(<srid>) column can declare 4326. Declaring another SRID, such as 4269 or 32633, fails with ST_INVALID_SRID_VALUE. Geometry values themselves can still carry any SRID. To keep data in another CRS instead of reprojecting it:
  • If the table is format-version 2, you can leave it as it is until its SRID can be declared. Spatial filters on its geometry column keep skipping data files.
  • Otherwise, create a GEOMETRY(0) column and copy with ST_SetSRID(geom, 0), or copy the table into a new format-version 2 table. See Data in another CRS.
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, except the format-version property, whatever its value. A table with a GEOMETRY(<srid>) column is format-version 3, which Wherobots sets when you leave the property out. Copying 'format-version' = '2' (or '1', from an older table) fails:
Create the table with CREATE TABLE as shown, then copy the rows into it. A CREATE TABLE ... AS SELECT over ST_SetSRID or ST_Transform creates another column with no declared CRS. See Tables created from a query.If the source table has a raster column, declare it as raster in the new table. See Raster columns before you continue.

Copy the rows

Pause the jobs that write to the source table before you copy, and keep them paused until you switch over. Rows written to the source table after the copy don’t reach the new table, and they are lost when you drop the old table.When every row is SRID 4326 or 0 and the coordinates are longitude and latitude:
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:

Compare the tables

If the source table was clustered, run CREATE SPATIAL INDEX on the new table as described in Cluster Tables with a Spatial Index.

Rename the tables and switch over

When the counts match, give the new table the name of the source table, so queries and jobs that use the name read the new table:
Leave the catalog name out of the new name. A rename stays within the catalog, and a new name that starts with the catalog name fails with TABLE_OR_VIEW_NOT_FOUND.The two renames are separate statements, so between them no table has the name my_db.places. A query that reads the table in that window fails with TABLE_OR_VIEW_NOT_FOUND, and if the second rename fails, the name stays missing until you run it again. Run the renames back to back while nothing reads the table, or make the readers retry.AWS Glue and Amazon S3 Tables catalogs don’t support ALTER TABLE ... RENAME TO. In a Glue catalog, point your queries and jobs at the new table name instead.Resume the paused writers once they use the new table.If a dbt table model builds the source table, change the model before you resume it. A table model rebuilds its table with create or replace table ... as select on every run, so its next run replaces the upgraded table, and a geometry column computed with an ST_ function loses its declared CRS again. Change it to an incremental model: incremental runs write into the existing table and keep its GEOMETRY(<srid>) column, as long as the model’s geometry values carry that SRID. Changing the materialization alone duplicates rows. The model’s query still selects every row on each run, and the default append strategy inserts all of them into a table that already holds the copied rows. Add an is_incremental() filter that selects only rows the table doesn’t have yet, or use the merge strategy with a unique_key so each run upserts its rows. A full refresh rebuilds the table from the query and drops the declared CRS.The new table starts its own snapshot history, so time travel to a snapshot from before the upgrade needs the old table. Drop the old table once nothing reads from it.
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.

Tables created from a query

CREATE TABLE ... AS SELECT, writeTo(...).create(), and writeTo(...).createOrReplace() take the column type from the query: To get a declared CRS for computed geometry, create the table with CREATE TABLE ... GEOMETRY(<srid>) first, then write to it with INSERT INTO ... SELECT or writeTo(...).append(). dbt table models that compute geometry with ST_ functions build their tables with create or replace table ... as select, so they also get a column with no declared CRS. A new table in a Wherobots-managed catalog is format-version 3 unless the statement sets 'format-version', and in a format-version 3 table, spatial filters on a column with no declared CRS read every data file.

Raster columns

A raster column copies across unchanged, because raster values are stored the same way on format-version 2 and 3 tables. On a format-version 3 table, SHOW CREATE TABLE prints the raster column as BINARY; it still holds rasters.

Geometry and Geography Tables

Creating, writing, updating, and querying geometry tables.

Cluster Tables with a Spatial Index

Spatial filter push-down and the full CREATE SPATIAL INDEX syntax.