Cloud Spanner supports adding and removing NOT NULL constraints on existing non-key columns via ALTER TABLE ... ALTER COLUMN ... SET NOT NULL and DROP NOT NULL, in both GoogleSQL and PostgreSQL dialects. The emulator does not. It rejects these statements with an internal check failure.
This blocks using the emulator for integration testing when migrations include nullability changes, which is a fairly common schema evolution pattern.
Repro (PostgreSQL dialect, via PGAdapter)
CREATE TABLE test (id text PRIMARY KEY, name text);
ALTER TABLE test ALTER COLUMN name SET NOT NULL;
The equivalent GoogleSQL statement also fails:
CREATE TABLE test (id STRING(MAX) NOT NULL, name STRING(MAX)) PRIMARY KEY(id);
ALTER TABLE test ALTER COLUMN name STRING(MAX) NOT NULL;
Expected
Both statements succeed, matching production Spanner behavior.
Actual
ERROR: ZETASQL_RET_CHECK failure (backend/schema/updater/schema_updater.cc:1562)
type == ddl::AlterTable::AlterColumn::SET_DEFAULT || type == ddl::AlterTable::AlterColumn::DROP_DEFAULT
The AlterColumn handler in schema_updater.cc has a check that only passes SET_DEFAULT and DROP_DEFAULT operations through. Any other alter type (including nullability changes) hits this assertion.
Versions tested
gcr.io/cloud-spanner-pg-adapter/pgadapter-emulator:v0.54.1
gcr.io/cloud-spanner-pg-adapter/pgadapter-emulator:v0.55.1
gcr.io/cloud-spanner-pg-adapter/pgadapter-emulator:latest (as of 2026-08-10)
All produce the same error.
Cloud Spanner supports adding and removing NOT NULL constraints on existing non-key columns via
ALTER TABLE ... ALTER COLUMN ... SET NOT NULLandDROP NOT NULL, in both GoogleSQL and PostgreSQL dialects. The emulator does not. It rejects these statements with an internal check failure.This blocks using the emulator for integration testing when migrations include nullability changes, which is a fairly common schema evolution pattern.
Repro (PostgreSQL dialect, via PGAdapter)
The equivalent GoogleSQL statement also fails:
Expected
Both statements succeed, matching production Spanner behavior.
Actual
The
AlterColumnhandler inschema_updater.cchas a check that only passesSET_DEFAULTandDROP_DEFAULToperations through. Any other alter type (including nullability changes) hits this assertion.Versions tested
gcr.io/cloud-spanner-pg-adapter/pgadapter-emulator:v0.54.1gcr.io/cloud-spanner-pg-adapter/pgadapter-emulator:v0.55.1gcr.io/cloud-spanner-pg-adapter/pgadapter-emulator:latest(as of 2026-08-10)All produce the same error.