38003
PostgreSQLERRORNotableExternal Routine ExceptionHIGH confidence

prohibited SQL statement attempted

What this means

SQLSTATE 38003 is raised when an external routine attempts to execute a statement that is prohibited in its declared data access category — for example, a NO SQL external function containing any SQL statement.

Why it happens
  1. 1An external function declared NO SQL executes a SQL statement
How to reproduce

NO SQL external function executing SQL.

expected output

ERROR:  prohibited statement attempted

Fix

Match the function data access attribute to its actual SQL usage

WHEN When the external function data access attribute is misconfigured.

Match the function data access attribute to its actual SQL usage
CREATE FUNCTION my_fn() RETURNS VOID
AS 'my_ext', 'my_fn'
LANGUAGE C
CONTAINS SQL; -- or READS SQL DATA / MODIFIES SQL DATA

Why this works

Set the correct data access attribute so the function is allowed to execute its SQL statements.

Sources
Official documentation ↗

Class 38 — External Routine Exception

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

← All PostgreSQL errors