pg_set_error_verbosity

PHP 5 >= 5.1.0, PHP 7, PHP 8
pg_set_error_verbosity - Determines the verbosity of messages returned by pg_last_error and pg_result_error
Manual
Code Examples

pg_set_error_verbosity( [PgSql\Connection$connection], int$verbosity ): int

Determines the verbosity of messages returned by pg_last_error and pg_result_error.

pg_set_error_verbosity sets the verbosity mode, returning the connection's previous setting. In PGSQL_ERRORS_TERSE mode, returned messages include severity, primary text, and position only; this will normally fit on a single line. The default mode (PGSQL_ERRORS_DEFAULT) produces messages that include the above plus any detail, hint, or context fields (these may span multiple lines). The PGSQL_ERRORS_VERBOSE mode includes all available fields. Changing the verbosity does not affect the messages available from already-existing result objects, only subsequently-created ones.

Parameters

connection

An PgSql\Connection instance. When connection is unspecified, the default connection is used. The default connection is the last connection made by pg_connect or pg_pconnect.

Warning:

As of PHP 8.1.0, using the default connection is deprecated.

verbosity

The required verbosity: PGSQL_ERRORS_TERSE, PGSQL_ERRORS_DEFAULT or PGSQL_ERRORS_VERBOSE.

Return Values

The previous verbosity level: PGSQL_ERRORS_TERSE, PGSQL_ERRORS_DEFAULT or PGSQL_ERRORS_VERBOSE.

Changelog

Version Description
8.1.0 The connection parameter expects an PgSql\Connection instance now; previously, a resource was expected.

Related Functions

Example of pg_set_error_verbosity

Show all examples for pg_set_error_verbosity

PHP Version:


Function pg_set_error_verbosity:

PostgreSQL Functions

Most used PHP functions