select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 39 · EXTERNAL ROUTINE INVOCATION EXCEPTION

external_routine_invocation_exception

SQLSTATE
39000
Condition name
external_routine_invocation_exception
Class
External Routine Invocation Exception
Source macro
ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>39000</h1>

At a glance

Fixed PostgreSQL 18.6 paths in contrib/pgcrypto report this ERROR for cryptographic library failures and invalid input lengths. The category can also carry other external routine invocation errors, so the exact library function and dynamic error text matter.

Meaning

Representative messages are crypt(3) returned NULL, encrypt error: %s, decrypt error: %s, encrypt_iv error: %s, decrypt_iv error: %s, and Length not in range. Several primary messages interpolate the dynamic library text returned by px_strerror(err); it is part of the primary message, not a separate DETAIL field.

Messages

Representative messages include crypt(3) returned NULL, encrypt error: %s, decrypt error: %s, encrypt_iv error: %s, decrypt_iv error: %s, and Length not in range. Several variants put the dynamic library text from px_strerror(err) directly in the primary message; it is not a separate DETAIL field.

Diagnosis

Identify the pgcrypto function and operation (crypt, encrypt/decrypt, IV form, or length validation). Preserve the dynamic error string and check input lengths, key/IV parameters, and library boundary; do not merge a library error with a SQLSTATE from a remote routine.

Response

Correct the named input or library/configuration problem and validate the same pgcrypto operation. Retry only when the operation is safe and no externally visible work was completed; a failed encryption call does not justify replaying a surrounding write.

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.

Sources

Read the fixed pgcrypto.c, pgp-cfb.c, and px.c paths alongside the structured evidence record.

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

39000 is external_routine_invocation_exception in SQLSTATE Class 39.

Method: Read the fixed errcodes definition row, severity, and macro.

src.errcodes.18.6

The fixed PostgreSQL 18.6 source contains the report contexts and message variants described on the page.

Method: Read the complete source context around the resolved report groups.

Limits: Source confirmation is not a runtime observation in this batch.

src.path.0 src.path.1 src.path.2

Locked release definitions establish catalogue presence from 7.4; they do not establish a precise introducing release or runtime use.

Method: Compare canonical release facts with the available history boundary.

Limits: Definition presence is not an emitting-path observation.

src.errcodes.18.6

Message templates

ERROR · message.pgcrypto-crypt-null

Primary

crypt(3) returned NULL
ERROR · message.pgcrypto-encrypt

Primary

encrypt error: %s

px_strerror(err) text is interpolated into the primary message.

ERROR · message.pgcrypto-decrypt

Primary

decrypt error: %s

px_strerror(err) text is interpolated into the primary message.

ERROR · message.pgcrypto-encrypt-iv

Primary

encrypt_iv error: %s

px_strerror(err) text is interpolated into the primary message.

ERROR · message.pgcrypto-decrypt-iv

Primary

decrypt_iv error: %s

px_strerror(err) text is interpolated into the primary message.

ERROR · message.pgcrypto-length

Primary

Length not in range
ERROR · message.pgcrypto-library-text

Primary

%s

The dynamic library text is the primary message, not a separate DETAIL field.

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Definition snapshot: english-manuals:c04f557f9eca3f303be04924db9… · English manual source