| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Cc: | nakamurajames123(at)gmail(dot)com |
| Subject: | BUG #19919: Internal Invalidation Error During Savepoint DDL After Dropping a Domain Constraint |
| Date: | 2026-11-19 01:28:34 |
| Message-ID: | 19919-c286b9e822bf23b9@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 19919
Logged by: Fin
Email address: nakamurajames123(at)gmail(dot)com
PostgreSQL version: 19rc2
Operating system: wsl linux
Description:
Reproduction Steps
The issue can be reproduced with the default server configuration. No
extensions are required. Execute the following statements as a regular user
who owns the domain:
CREATE DOMAIN d AS int CONSTRAINT c CHECK (value > 0);
BEGIN;
ALTER DOMAIN d DROP CONSTRAINT c;
SAVEPOINT s;
DROP DOMAIN d;
The same error also occurs when replacing DROP DOMAIN d with either of the
following:
- DROP TABLE t; (where table t contains a column of the domain type)
- ALTER DOMAIN d ADD CONSTRAINT c2 CHECK (value < 5);
Expected Behavior
DDL statements executed within a savepoint should complete successfully.
Without the savepoint, the same DROP TABLE and DROP DOMAIN statements
execute successfully.
The issue should also not occur in clients that automatically create a
savepoint for each statement, such as psql with ON_ERROR_ROLLBACK enabled.
Actual Behavior
After executing ALTER DOMAIN ... DROP CONSTRAINT within a transaction,
creating a savepoint and executing DDL inside it results in an internal
error (SQLSTATE XX000).
This is an internal error that should not be exposed to users. The server
does not crash.
Both the master branch (PostgreSQL 20devel) and PostgreSQL 19.0 are
affected.
Logs
1. psql output, master (PostgreSQL 20devel, 0cf2d43d326, with \set VERBOSITY
verbose):
CREATE DOMAIN d AS int CONSTRAINT c CHECK (value > 0);
CREATE DOMAIN
BEGIN;
BEGIN
ALTER DOMAIN d DROP CONSTRAINT c;
ALTER DOMAIN
SAVEPOINT s;
SAVEPOINT
DROP DOMAIN d;
ERROR: XX000: cannot start a subtransaction when there are unprocessed
inval messages
LOCATION: PrepareInvalidationState, inval.c:715
Control case (without a savepoint, succeeds):
BEGIN;
ALTER DOMAIN d DROP CONSTRAINT c;
ALTER DOMAIN
DROP TABLE t;
DROP TABLE
DROP DOMAIN d;
DROP DOMAIN
2. Server log, master:
2026-11-19 10:27:20.516 KST [3179113] ERROR: cannot start a subtransaction
when there are unprocessed inval messages
2026-11-19 10:27:20.516 KST [3179113] STATEMENT: DROP DOMAIN d;
2026-11-19 10:27:20.518 KST [3179113] ERROR: cannot start a subtransaction
when there are unprocessed inval messages
2026-11-19 10:27:20.518 KST [3179113] STATEMENT: DROP TABLE t;
2026-11-19 10:27:20.519 KST [3179113] ERROR: cannot start a subtransaction
when there are unprocessed inval messages
2026-11-19 10:27:20.519 KST [3179113] STATEMENT: ALTER DOMAIN d ADD
CONSTRAINT c2 CHECK (value < 5);
3. PostgreSQL 19.0 (REL_19_STABLE, 19aa5713be2):
All three cases produce the same error. Only the source line number differs:
ERROR: XX000: cannot start a subtransaction when there are unprocessed
inval messages
LOCATION: PrepareInvalidationState, inval.c:717
| From | Date | Subject | |
|---|---|---|---|
| Next Message | PG Bug reporting form | 2026-11-19 01:33:35 | BUG #19920: Out-of-Bounds Read on a Zero-Length Array in pg_trgm word_similarity('', '') |
| Previous Message | PG Bug reporting form | 2026-11-19 01:21:24 | BUG #19918: SIGSEGV in auto_explain + EXPLAIN (BUFFERS) |