25007
PostgreSQLERRORNotableInvalid Transaction StateHIGH confidence

schema and data statement mixing not supported

What this means

SQLSTATE 25007 is raised when both DDL (schema-changing) statements and DML (data-modifying) statements are mixed in a transaction in a context that does not support this combination.

Why it happens
  1. 1Mixing DDL and DML in a transaction in a distributed or external system that does not support it (rare in standard Postgres)
How to reproduce

DDL/DML mixing in an unsupported context.

expected output

ERROR:  schema and data statement mixing not supported

Fix

Separate DDL and DML into different transactions

WHEN When this error appears.

Why this works

Execute schema changes first in one transaction, then data modifications in a subsequent transaction.

Sources
Official documentation ↗

Class 25 — Invalid Transaction State

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All PostgreSQL errors