# 38002 — modifying_sql_data_not_permitted

> Source-backed reference for PostgreSQL SQLSTATE 38002.
---

# 38002

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

This Class 38 member names a modifying-data restriction. The fixed PostgreSQL 18.6 core/contrib scan found no resolved report group for it, so it must not be conflated with the separately named 2F002 member.

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

| Field | Value |
| --- | --- |
| SQLSTATE | `38002` |
| Condition | `modifying_sql_data_not_permitted` |
| 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_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED` |
| Aliases | `—` |

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

## Meaning {#meaning}

The distinction is the SQLSTATE and the routine standard class, not a guessed PostgreSQL function-volatility rule. Preserve whether the routine was external, remote, or client-owned.

## Messages {#messages}

No fixed PostgreSQL message variant was adopted because the bounded scan did not resolve a native report group.

## Diagnosis {#diagnosis}

Inspect the routine declaration and the implementation that enforced it; determine whether the attempted operation modified SQL data and which boundary supplied the error.

## Response {#response}

Change the declared data-access contract only when its owner documents that repair, or move the write to an allowed boundary. Do not infer a generic retry.

## Versions {#versions}

The locked catalogue places this condition at least by PostgreSQL 7.4. The facts block lists the published snapshots; source-path status is limited to the fixed PostgreSQL 18.6 evidence below.

## Related {#related}

[`38000`](../38000/), [`2F000`](../2f000/)

## Sources {#sources}

See the fixed source links and message limits in the structured [evidence record](../data/evidence/38002.json).
