select open change scope Open full search

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

FUNCTIONS / SYSTEM INFORMATION FUNCTIONS AND OPERATORS

pg_input_error_info

Read PG 18 manual ↗

Tests whether the given string is valid input for the specified data type; if not, return the details of the error that would have been thrown.

Signatures & examples

pg_input_error_info ( string text, type text ) → record ( message text, detail text, hint text, sql_error_code text )
Tests whether the given string is valid input for the specified data type; if not, return the details of the error that would have been thrown. If the input is valid, the results are NULL. The inputs are the same as for pg_input_is_valid.
SELECT * FROM pg_input_error_info('42000000000', 'integer') →                        message                        | detail | hint | sql_error_code
------------------------------------------------------+--------+------+----------------
 value "42000000000" is out of range for type integer |        |      | 22003
Version history 1
  1. PG 15 → 16added

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source