# Method Sql.pgsql()->error()

Method error

  ``final` `string` error(`void`|`int` `clear`)`

Returns

  The textual description of the last server-related error. Returns `0` if no error has occurred yet. It is not cleared upon reading (can be invoked multiple times, will return the same result until a new error occurs).

  During the execution of a statement, this function accumulates all non-error messages (notices, warnings, etc.). If a statement does not generate any errors, this function will return all collected messages since the last statement.

Note

  The string returned is not newline-terminated.

Parameter `clear`

  To clear the error, set it to `1`.

See also

  big_query()