# 42P12 — Invalid database definition

> Source-backed reference for PostgreSQL SQLSTATE 42P12.
---

# 42P12 — Invalid database definition

## At a glance {#at-a-glance}

`42P12` (**invalid_database_definition**) This condition names an invalid database definition, but its core emitter was not resolved in this scan.

<!-- BEGIN SQLSTATE FACTS: generated by scripts/generate.py; do not edit -->

| Field | Value |
| --- | --- |
| SQLSTATE | `42P12` |
| Condition | `invalid_database_definition` |
| Status | `active` |
| Known present by | `7.4` |
| Locked snapshots | `9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3` |
| Macros | `ERRCODE_INVALID_DATABASE_DEFINITION` |
| Aliases | `—` |

<!-- source facts: data/errcodes/42P12.json -->
<!-- END SQLSTATE FACTS -->

## Meaning {#meaning}

The catalogue condition is defined as invalid_database_definition. The bounded 18.6 call scan did not resolve a core emitting group for this code, so this page gives the condition boundary without inventing a database-operation trigger.

## Diagnosis {#diagnosis}

When it appears, retain the server message, database name, statement, and server log context. First determine whether the response came from PostgreSQL core, an extension, a client-side mapping, or a wrapper; the condition name alone does not identify the failing catalogue object.

## Response {#response}

Use the resolved message and fixed-version source path to choose a repair. Check the affected database definition and dependencies only after the actual emitter is identified; this bounded scan does not support a more specific SQL recipe or a fixed severity. If the actual response is an ERROR inside an explicit transaction, apply the normal `ROLLBACK` or pre-error savepoint rule, but do not present that generic protocol recovery as a confirmed 42P12 emitter path.

## Messages {#messages}

No message variant is included because the bounded source scan did not resolve a core emitting group for this condition.

## Versions {#versions}

The locked catalogue shows this condition by PostgreSQL 7.4; behavior here is fixed to PostgreSQL 18.6 source. Catalogue presence is a range boundary, not proof that every message or feature began in that release.

## Related {#related}

- [`3D000`](../3d000/)
- [`42P04`](../42p04/)

## Sources {#sources}

Source messages, line anchors, and evidence limits are recorded in [authored evidence](../data/evidence/42p12.json).

- The fixed definition is recorded in [`errcodes.txt`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L393).
