pg_result_error_field

FunctionParams changed in PHP 8.1

Returns an individual field of an error report.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
Improved
PHP 8.2-8.3
PHP 8.4
PHP 8.5
PHP 8.6

pg_result_error_field Function synopsis

pg_result_error_field(PgSql\Result $result, int $field_code): string|false|null

Parameters

$result

TypePgSql\Result

$field_code

Typeint

Possible $field_code values are: PGSQL_DIAG_SEVERITY, PGSQL_DIAG_SQLSTATE, PGSQL_DIAG_MESSAGE_PRIMARY, PGSQL_DIAG_MESSAGE_DETAIL, PGSQL_DIAG_MESSAGE_HINT, PGSQL_DIAG_STATEMENT_POSITION, PGSQL_DIAG_INTERNAL_POSITION, PGSQL_DIAG_INTERNAL_QUERY, PGSQL_DIAG_CONTEXT, PGSQL_DIAG_SOURCE_FILE, PGSQL_DIAG_SOURCE_LINE or PGSQL_DIAG_SOURCE_FUNCTION.

Return value

Typestring|false|null

A string containing the contents of the error field, null if the field does not exist or false on failure.

Changes to the pg_result_error_field Function

PHP 8.1

  • Parameter type added for parameter #1 ($result): PgSql\Result
- pg_result_error_field($result, int $field_code): string|false|null
+ pg_result_error_field(PgSql\Result $result, int $field_code): string|false|null

PHP 8.0

  • Return type added: string|false|null
  • Parameter name of parameter #2 changed: $fieldcode to $field_code
  • Parameter type added for parameter #2 ($field_code): int
- pg_result_error_field($result, $fieldcode)
+ pg_result_error_field($result, int $field_code): string|false|null

pg_result_error_field Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release Yes
PHP 8.5Supported (Latest) Yes
PHP 8.4Supported Yes
PHP 8.3Security-Fixes Only Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Unsupported Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes