exit_on_error is a configuration parameter determining whether a session should be terminated if an error occurs.
exit_on_error was added in PostgreSQL 7.4.
Default value for
By default, only
FATAL errors will terminate a session. However, if
exit_on_error is set to
on, any error will result in the session being terminated.
However in some circumstances, such as loading SQL from a script, it may be desirable to ensure processing is halted if an error occurs, to prevent potentially bad data being loaded.
Usage demonstration for
exit_on_error in a
postgres=# SELECT 1 FROM foo; ERROR: relation "foo" does not exist LINE 1: SELECT 1 FROM foo; ^ postgres=# SET exit_on_error TO on; SET postgres=# SELECT 1 FROM foo; FATAL: relation "foo" does not exist LINE 1: SELECT 1 FROM foo; ^ server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Succeeded.