Skip to content

DROP DOMAIN drops a domain that another domain depends on, and pg_type becomes unreadable #4005

In review

Description

@turbolytics

We run PostgreSQL compatibility checks with our tool, Temper. This came from comparing Doltgres 1.5.3 with PostgreSQL 17.

DROP DOMAIN succeeds on a domain that another domain is built on. After that, every query of pg_type in that database fails. PostgreSQL refuses the drop.

Minimal repro.

docker run -d --name dg -e DOLTGRES_USER=postgres -e DOLTGRES_PASSWORD=postgres dolthub/doltgresql:1.5.3
docker exec -it dg psql -X postgresql://postgres:postgres@localhost:5432/postgres
CREATE DOMAIN domaindroptest int4;
CREATE DOMAIN dependenttypetest domaindroptest;
DROP DOMAIN domaindroptest;
SELECT count(*) FROM pg_type;
Statement PostgreSQL 17 Doltgres 1.5.3
DROP DOMAIN domaindroptest ERROR: cannot drop type domaindroptest because other objects depend on it DROP DOMAIN
SELECT count(*) FROM pg_type 621 ERROR: unable to resolve type `domaindroptest` during deserialization

What happens next:

  • Any query that reads pg_type fails with the same error. That includes \dT in psql and SELECT typname FROM pg_type WHERE typname = 'int4'.
  • A server restart does not clear it.
  • DROP DOMAIN dependenttypetest fails with the same error, so I found no way to repair the database.
  • Tables in the database still work, and other databases are not affected.

Temper matrix and repro. Temper helped identify this. The check is one row of our Doltgres matrix: schema.drop_refuses_dependents fails on Doltgres 1.5.3 and on a build of main from 2026-11-24 (273c5bd), and passes on PostgreSQL 17. To rerun it with Temper v0.1.9 and Docker:

git clone -b temper-map https://github.com/turbolytics/doltgresql && cd doltgresql
git checkout 3de3be0
temper scenarios run --scenario answers.drop_domain --subject doltgres.release --build

The command exits 1 and prints fail answers.drop_domain/doltgres.release/schema.drop_refuses_dependents: 4 violations. The scenario and its check are in that commit.

I used an AI assistant to run the checks and draft this. I verified every result on a fresh dolthub/doltgresql:1.5.3 container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions