libpqxx
The C++ client library for PostgreSQL
Exception classes

Classes

struct  pqxx::failure
 Base class for all exceptions specific to libpqxx. More...
 
struct  pqxx::broken_connection
 Exception class for lost or failed backend connection. More...
 
struct  pqxx::version_mismatch
 Could not establish connection due to version mismatch. More...
 
struct  pqxx::variable_set_to_null
 The caller attempted to set a variable to null, which is not allowed. More...
 
struct  pqxx::sql_error
 Exception class for failed queries. More...
 
struct  pqxx::protocol_violation
 Exception class for mis-communication with the server. More...
 
struct  pqxx::in_doubt_error
 "Help, I don't know whether transaction was committed successfully!" More...
 
struct  pqxx::transaction_rollback
 The backend saw itself forced to roll back the ongoing transaction. More...
 
struct  pqxx::serialization_failure
 Transaction failed to serialize. Please retry the whole thing. More...
 
struct  pqxx::statement_completion_unknown
 We can't tell whether our last statement succeeded. More...
 
struct  pqxx::deadlock_detected
 The ongoing transaction has deadlocked. Retrying it may help. More...
 
struct  pqxx::internal_error
 Internal error in libpqxx library. More...
 
struct  pqxx::usage_error
 Error in usage of libpqxx library, similar to std::logic_error. More...
 
struct  pqxx::argument_error
 Invalid argument passed to libpqxx, similar to std::invalid_argument. More...
 
struct  pqxx::conversion_error
 Value conversion failed, e.g. when converting "Hello" to int. More...
 
struct  pqxx::unexpected_null
 Could not convert null value: target type does not support null. More...
 
struct  pqxx::conversion_overrun
 Could not convert value to string: not enough buffer space. More...
 
struct  pqxx::range_error
 Something is out of range, similar to std::out_of_range. More...
 
struct  pqxx::unexpected_rows
 Query returned an unexpected number of rows. More...
 
struct  pqxx::feature_not_supported
 Database feature not supported in current setup. More...
 
struct  pqxx::data_exception
 Error in data provided to SQL statement. More...
 
struct  pqxx::integrity_constraint_violation
 
struct  pqxx::restrict_violation
 
struct  pqxx::not_null_violation
 
struct  pqxx::foreign_key_violation
 
struct  pqxx::unique_violation
 
struct  pqxx::check_violation
 
struct  pqxx::invalid_cursor_state
 
struct  pqxx::invalid_sql_statement_name
 
struct  pqxx::invalid_cursor_name
 
struct  pqxx::syntax_error
 
struct  pqxx::undefined_column
 
struct  pqxx::undefined_function
 
struct  pqxx::undefined_table
 
struct  pqxx::insufficient_privilege
 
struct  pqxx::insufficient_resources
 Resource shortage on the server. More...
 
struct  pqxx::disk_full
 
struct  pqxx::server_out_of_memory
 
struct  pqxx::too_many_connections
 
struct  pqxx::plpgsql_error
 PL/pgSQL error. More...
 
struct  pqxx::plpgsql_raise
 Exception raised in PL/pgSQL procedure. More...
 
struct  pqxx::plpgsql_no_data_found
 
struct  pqxx::plpgsql_too_many_rows
 

Detailed Description

All exception types thrown by libpqxx are derived from pqxx::failure, so that should be your starting point in exploring them. When you write a catch clause in your code, it's probably worth either having a separate clause for failure and its subclasses, or checking at run time whether an error is of this type using dynamic_cast<pqxx::failure const *>(...). if the exception is a libpqxx exception, you can get a lot of extra information that's not normally available in exceptions.

There is no multiple inheritance in this class hierarchy. That means that the different kinds of libpqxx exception are not reflected in inheritance from std::logic_error, std::runtime_error, and so on. They are all derived from pqxx::failure (whether directly or indirectly), which in turn inherits directly from std::exception.

You may wonder whether this was the best design decision. Before libpqxx 8, various libpqxx exceptions derived from different types in the standard C++ exception hierarchy (std::out_of_range, std::argument_error, and so on). But in practice we saw that:

  1. The standard exception type distinctions are not very actionable.
  2. Applications would generally just catch std::exception anyway.
  3. Important properties never quite follow a neat hierarchy.
  4. Making effective use of the hierarchy was hard, finicky work.
  5. A try could end up with a lot of highly similar catch clauses.
  6. Shaping the hierarchy around one exception property would confuse another.

So as of libpqxx 8, if you want more detail in how you handle different types of exceptions, you use member functions, mostly at run time. All of the properties are available right from the top down, in the failure base class. Some of the strings will not apply to all types of exception, but in those cases, they will simply be empty strings.

In libpqxx, the exception hierarchy exists not for taxonomy's sake but to enable your application to function well without requiring too much code or effort from you. In most cases, when an exception occurs, both the safest and the easiest thing to do is drop the objects involved in the error, report what happened, and move on from a reliable state. That is what these classes are here to support.


Class Documentation

◆ pqxx::failure

struct pqxx::failure

Base class for all exceptions specific to libpqxx.

+ Inheritance diagram for pqxx::failure:
+ Collaboration diagram for pqxx::failure:

Public Member Functions

 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 
virtual bool poisons_transaction () const noexcept
 Does this type of error make an ongoing dbtransaction unusable? More...
 
virtual std::string_view name () const noexcept
 The name of this exception type: "failure", "sql_error", etc. More...
 

Protected Member Functions

 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ failure() [1/5]

pqxx::failure::failure ( failure const &  )
default

◆ failure() [2/5]

pqxx::failure::failure ( failure &&  )
default

◆ failure() [3/5]

pqxx::failure::failure ( sl  loc = sl::current(),
st  tr = st::current() 
)
inlineexplicit

◆ failure() [4/5]

pqxx::failure::failure ( std::string  whatarg,
sl  loc = sl::current(),
st  tr = st::current() 
)
inlineexplicit

◆ ~failure()

pqxx::failure::~failure ( )
overridedefaultnoexcept

◆ failure() [5/5]

pqxx::failure::failure ( std::string  whatarg,
std::string  stat,
std::string  sqls,
sl  loc = sl::current(),
st  tr = st::current() 
)
inlineprotected

For constructing derived exception types with the additional fields.

Member Function Documentation

◆ location()

PQXX_PURE sl const& pqxx::failure::location ( ) const
inlinenoexcept

Best known std::source_location for where the error occurred.

Generally there's no one single source location, but the exception only stores one. This is generally either one that the caller passed to a libpqxx call, or the place where the caller called libpqxx.

◆ name()

std::string_view pqxx::failure::name ( ) const
virtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}
The ongoing transaction has deadlocked. Retrying it may help.
Definition: except.hxx:544
Base class for all exceptions specific to libpqxx.
Definition: except.hxx:76

Reimplemented in pqxx::plpgsql_too_many_rows, pqxx::plpgsql_no_data_found, pqxx::plpgsql_raise, pqxx::plpgsql_error, pqxx::too_many_connections, pqxx::server_out_of_memory, pqxx::disk_full, pqxx::insufficient_resources, pqxx::insufficient_privilege, pqxx::undefined_table, pqxx::undefined_function, pqxx::undefined_column, pqxx::syntax_error, pqxx::invalid_cursor_name, pqxx::invalid_sql_statement_name, pqxx::invalid_cursor_state, pqxx::check_violation, pqxx::unique_violation, pqxx::foreign_key_violation, pqxx::not_null_violation, pqxx::restrict_violation, pqxx::integrity_constraint_violation, pqxx::data_exception, pqxx::feature_not_supported, pqxx::unexpected_rows, pqxx::range_error, pqxx::conversion_overrun, pqxx::unexpected_null, pqxx::conversion_error, pqxx::argument_error, pqxx::usage_error, pqxx::internal_error, pqxx::deadlock_detected, pqxx::statement_completion_unknown, pqxx::serialization_failure, pqxx::transaction_rollback, pqxx::in_doubt_error, pqxx::protocol_violation, pqxx::sql_error, pqxx::variable_set_to_null, pqxx::version_mismatch, and pqxx::broken_connection.

◆ operator=() [1/2]

failure& pqxx::failure::operator= ( failure &&  )
default

◆ operator=() [2/2]

failure& pqxx::failure::operator= ( failure const &  )
default

◆ poisons_connection()

virtual bool pqxx::failure::poisons_connection ( ) const
inlinevirtualnoexcept

Does this type of error make the current connection unusable?

If the answer is true, assume that there is nothing more you can get done using your existing connection object. It may still be possible, but it may fail, or things could conceivably be in a confused state where it's just not a good idea to try.

If your connection is poisoned, then it follows that any ongoing transaction will no longer be usable either.

Note
This is a general indication based on the type of exception. It can be wrong for some specific situations.

Reimplemented in pqxx::feature_not_supported, pqxx::internal_error, pqxx::statement_completion_unknown, pqxx::in_doubt_error, pqxx::protocol_violation, and pqxx::broken_connection.

◆ poisons_transaction()

virtual bool pqxx::failure::poisons_transaction ( ) const
inlinevirtualnoexcept

Does this type of error make an ongoing dbtransaction unusable?

When this is the case, before you try to do anything else, you'll want to close any transaction you may have open. If necessary, a call to poisons_connection() will tell you whether it is still possible (and advisable) to open a new one on the same connection.

If you are using a nontransaction, bear in mind that it is not derived from dbtransaction. So if you see an exception which reports that it poisons transactions but not the connection, then a nontransaction should still be usable.

Note
This is a general indication based on the type of exception. It can be wrong for some specific situations.

Reimplemented in pqxx::feature_not_supported, pqxx::usage_error, pqxx::internal_error, pqxx::serialization_failure, pqxx::transaction_rollback, pqxx::in_doubt_error, pqxx::protocol_violation, pqxx::sql_error, and pqxx::broken_connection.

◆ query()

PQXX_PURE std::string_view pqxx::failure::query ( ) const
inlinenoexcept

SQL statement that encountered the error, if applicable; or empty string.

In some cases there will be a placeholder string, to give a rough indication of an SQL operation that's being performed in your name, such as beginning or committing a transaction. Those will be in square brackets: [COMMIT] etc.

◆ sqlstate()

PQXX_PURE std::string_view pqxx::failure::sqlstate ( ) const
inlinenoexcept

SQLSTATE error code, or empty string if unavailable.

The PostgreSQL error codes are documented here:

https://www.postgresql.org/docs/current/errcodes-appendix.html

◆ trace()

PQXX_PURE std::shared_ptr<st const> pqxx::failure::trace ( ) const
inlinenoexcept

If available in this compiler, a std::stacktrace of this exception.

The stacktrace does not include the creation of the exception object itself. By default it goes right up to that point. You can pass a stacktrace of your own choosing to the exception constructors, if you really want, but it generally makes more sense to use the default.

If std::stacktrace was not available when the libpqxx build was configured, this returns an empty ("null") pointer to pqxx::stacktrace_placeholder.

This is meant to keep the ABI for pqxx::failure stable across builds with and without std::stacktrace, and make it easy to upgrade the compiler and get the feature.

◆ what()

PQXX_PURE char const* pqxx::failure::what ( ) const
inlineoverridenoexcept

Error message.

◆ pqxx::broken_connection

struct pqxx::broken_connection

Exception class for lost or failed backend connection.

Warning
When this happens on Unix-like systems, you may also get a SIGPIPE signal. That signal aborts the program by default, so if you wish to be able to continue after a connection breaks, be sure to disarm this signal.

If you're working on a Unix-like system, see the manual page for signal (2) on how to deal with SIGPIPE. The easiest way to make this signal harmless is to make your program ignore it:

#include <csignal>
int main()
{
std::signal(SIGPIPE, SIG_IGN);
// ...
}
+ Inheritance diagram for pqxx::broken_connection:
+ Collaboration diagram for pqxx::broken_connection:

Public Member Functions

 broken_connection (sl loc=sl::current(), st &&tr=st::current())
 
 broken_connection (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
bool poisons_connection () const noexcept override
 By its nature, this type of error makes the connection unusable. More...
 
bool poisons_transaction () const noexcept override
 When the connection breaks, so will an ongoing transaction. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ broken_connection() [1/2]

pqxx::broken_connection::broken_connection ( sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

◆ broken_connection() [2/2]

pqxx::broken_connection::broken_connection ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::broken_connection::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::failure.

Reimplemented in pqxx::too_many_connections, and pqxx::version_mismatch.

◆ poisons_connection()

bool pqxx::broken_connection::poisons_connection ( ) const
inlineoverridevirtualnoexcept

By its nature, this type of error makes the connection unusable.

Reimplemented from pqxx::failure.

◆ poisons_transaction()

bool pqxx::broken_connection::poisons_transaction ( ) const
inlineoverridevirtualnoexcept

When the connection breaks, so will an ongoing transaction.

Reimplemented from pqxx::failure.

◆ pqxx::version_mismatch

struct pqxx::version_mismatch

Could not establish connection due to version mismatch.

+ Inheritance diagram for pqxx::version_mismatch:
+ Collaboration diagram for pqxx::version_mismatch:

Public Member Functions

 version_mismatch (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::broken_connection
 broken_connection (sl loc=sl::current(), st &&tr=st::current())
 
 broken_connection (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
bool poisons_connection () const noexcept override
 By its nature, this type of error makes the connection unusable. More...
 
bool poisons_transaction () const noexcept override
 When the connection breaks, so will an ongoing transaction. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ version_mismatch()

pqxx::version_mismatch::version_mismatch ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::version_mismatch::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::broken_connection.

◆ pqxx::variable_set_to_null

struct pqxx::variable_set_to_null

The caller attempted to set a variable to null, which is not allowed.

+ Inheritance diagram for pqxx::variable_set_to_null:
+ Collaboration diagram for pqxx::variable_set_to_null:

Public Member Functions

 variable_set_to_null (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 
virtual bool poisons_transaction () const noexcept
 Does this type of error make an ongoing dbtransaction unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ variable_set_to_null()

pqxx::variable_set_to_null::variable_set_to_null ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::variable_set_to_null::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::failure.

◆ pqxx::sql_error

struct pqxx::sql_error

Exception class for failed queries.

Carries, in addition to a regular error message, a copy of the failed query and (if available) the SQLSTATE value accompanying the error.

These exception classes follow, roughly, the two-level hierarchy defined by the PostgreSQL SQLSTATE error codes (see Appendix A of the PostgreSQL documentation corresponding to your server version). This is not a complete mapping though. There are other differences as well, e.g. the error code for statement_completion_unknown has a separate status in libpqxx as in_doubt_error, and too_many_connections is classified as a broken_connection rather than a subtype of insufficient_resources.

+ Inheritance diagram for pqxx::sql_error:
+ Collaboration diagram for pqxx::sql_error:

Public Member Functions

PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ sql_error() [1/3]

PQXX_ZARGS pqxx::sql_error::sql_error ( std::string const &  whatarg = {},
std::string const &  stmt = {},
std::string const &  sqls = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

◆ sql_error() [2/3]

pqxx::sql_error::sql_error ( sql_error const &  other)
default

◆ sql_error() [3/3]

pqxx::sql_error::sql_error ( sql_error &&  other)
default

◆ ~sql_error()

pqxx::sql_error::~sql_error ( )
overridedefault

Member Function Documentation

◆ name()

std::string_view pqxx::sql_error::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::failure.

Reimplemented in pqxx::plpgsql_too_many_rows, pqxx::plpgsql_no_data_found, pqxx::plpgsql_raise, pqxx::plpgsql_error, pqxx::server_out_of_memory, pqxx::disk_full, pqxx::insufficient_resources, pqxx::insufficient_privilege, pqxx::undefined_table, pqxx::undefined_function, pqxx::undefined_column, pqxx::syntax_error, pqxx::invalid_cursor_name, pqxx::invalid_sql_statement_name, pqxx::invalid_cursor_state, pqxx::check_violation, pqxx::unique_violation, pqxx::foreign_key_violation, pqxx::not_null_violation, pqxx::restrict_violation, pqxx::integrity_constraint_violation, pqxx::data_exception, pqxx::feature_not_supported, pqxx::deadlock_detected, pqxx::statement_completion_unknown, pqxx::serialization_failure, pqxx::transaction_rollback, and pqxx::protocol_violation.

◆ operator=() [1/2]

sql_error& pqxx::sql_error::operator= ( sql_error &&  other)
default

◆ operator=() [2/2]

sql_error& pqxx::sql_error::operator= ( sql_error const &  other)
default

◆ poisons_transaction()

bool pqxx::sql_error::poisons_transaction ( ) const
inlineoverridevirtualnoexcept

If a transaction was ongoing, an SQL error will break it.

Reimplemented from pqxx::failure.

Reimplemented in pqxx::feature_not_supported, pqxx::serialization_failure, pqxx::transaction_rollback, and pqxx::protocol_violation.

◆ pqxx::protocol_violation

struct pqxx::protocol_violation

Exception class for mis-communication with the server.

This happens when the conversation between libpq and the server gets messed up. There aren't many situations where this happens, but one known instance is when you call a parameterised or prepared statement with the wrong number of parameters.

When this happens, your connection will most likely be in a broken state and you're probably best off discarding it and starting a new one. In that sense it is like broken_connection.

Retrying your statement is not likely to make this problem go away.

+ Inheritance diagram for pqxx::protocol_violation:
+ Collaboration diagram for pqxx::protocol_violation:

Public Member Functions

 protocol_violation (std::string const &whatarg, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
bool poisons_connection () const noexcept override
 When this happens, the connection is in a confused state. More...
 
bool poisons_transaction () const noexcept override
 Since the connection is broken, so is a transaction. More...
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ protocol_violation()

pqxx::protocol_violation::protocol_violation ( std::string const &  whatarg,
std::string const &  stmt = {},
std::string const &  sqls = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::protocol_violation::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

◆ poisons_connection()

bool pqxx::protocol_violation::poisons_connection ( ) const
inlineoverridevirtualnoexcept

When this happens, the connection is in a confused state.

Reimplemented from pqxx::failure.

◆ poisons_transaction()

bool pqxx::protocol_violation::poisons_transaction ( ) const
inlineoverridevirtualnoexcept

Since the connection is broken, so is a transaction.

Reimplemented from pqxx::sql_error.

◆ pqxx::in_doubt_error

struct pqxx::in_doubt_error

"Help, I don't know whether transaction was committed successfully!"

Exception that might be thrown in rare cases where the connection to the database is lost while finishing a database transaction, and there's no way of telling whether it was actually executed by the backend. In this case the database is left in an indeterminate (but consistent) state, and only manual inspection will tell which is the case.

+ Inheritance diagram for pqxx::in_doubt_error:
+ Collaboration diagram for pqxx::in_doubt_error:

Public Member Functions

 in_doubt_error (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
bool poisons_connection () const noexcept override
 This kind of error can only happen when the connection breaks. More...
 
bool poisons_transaction () const noexcept override
 The transaction is already closed, and the connection is broken. More...
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ in_doubt_error()

pqxx::in_doubt_error::in_doubt_error ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::in_doubt_error::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::failure.

◆ poisons_connection()

bool pqxx::in_doubt_error::poisons_connection ( ) const
inlineoverridevirtualnoexcept

This kind of error can only happen when the connection breaks.

Reimplemented from pqxx::failure.

◆ poisons_transaction()

bool pqxx::in_doubt_error::poisons_transaction ( ) const
inlineoverridevirtualnoexcept

The transaction is already closed, and the connection is broken.

Reimplemented from pqxx::failure.

◆ pqxx::transaction_rollback

struct pqxx::transaction_rollback

The backend saw itself forced to roll back the ongoing transaction.

+ Inheritance diagram for pqxx::transaction_rollback:
+ Collaboration diagram for pqxx::transaction_rollback:

Public Member Functions

PQXX_ZARGS transaction_rollback (std::string const &whatarg, std::string const &q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
bool poisons_transaction () const noexcept override
 Some earlier failure broke the transaction. More...
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ transaction_rollback()

PQXX_ZARGS pqxx::transaction_rollback::transaction_rollback ( std::string const &  whatarg,
std::string const &  q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::transaction_rollback::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

Reimplemented in pqxx::deadlock_detected, pqxx::statement_completion_unknown, and pqxx::serialization_failure.

◆ poisons_transaction()

bool pqxx::transaction_rollback::poisons_transaction ( ) const
inlineoverridevirtualnoexcept

Some earlier failure broke the transaction.

Reimplemented from pqxx::sql_error.

Reimplemented in pqxx::serialization_failure.

◆ pqxx::serialization_failure

struct pqxx::serialization_failure

Transaction failed to serialize. Please retry the whole thing.

Can only happen at transaction isolation levels REPEATABLE READ and SERIALIZABLE.

The current transaction cannot be committed without violating the guarantees made by its isolation level. This is the effect of a conflict with another ongoing transaction. The transaction may still succeed if you try to perform it again.

+ Inheritance diagram for pqxx::serialization_failure:
+ Collaboration diagram for pqxx::serialization_failure:

Public Member Functions

PQXX_ZARGS serialization_failure (std::string const &whatarg, std::string const &q, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
bool poisons_transaction () const noexcept override
 To retry the transaction, you'll need to start a fresh one. More...
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::transaction_rollback
PQXX_ZARGS transaction_rollback (std::string const &whatarg, std::string const &q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ serialization_failure()

PQXX_ZARGS pqxx::serialization_failure::serialization_failure ( std::string const &  whatarg,
std::string const &  q,
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::serialization_failure::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::transaction_rollback.

◆ poisons_transaction()

bool pqxx::serialization_failure::poisons_transaction ( ) const
inlineoverridevirtualnoexcept

To retry the transaction, you'll need to start a fresh one.

Reimplemented from pqxx::transaction_rollback.

◆ pqxx::statement_completion_unknown

struct pqxx::statement_completion_unknown

We can't tell whether our last statement succeeded.

+ Inheritance diagram for pqxx::statement_completion_unknown:
+ Collaboration diagram for pqxx::statement_completion_unknown:

Public Member Functions

PQXX_ZARGS statement_completion_unknown (std::string const &whatarg, std::string const &q, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
bool poisons_connection () const noexcept override
 It's not advisable to continue using the connection after this. More...
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::transaction_rollback
PQXX_ZARGS transaction_rollback (std::string const &whatarg, std::string const &q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
bool poisons_transaction () const noexcept override
 Some earlier failure broke the transaction. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ statement_completion_unknown()

PQXX_ZARGS pqxx::statement_completion_unknown::statement_completion_unknown ( std::string const &  whatarg,
std::string const &  q,
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::statement_completion_unknown::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::transaction_rollback.

◆ poisons_connection()

bool pqxx::statement_completion_unknown::poisons_connection ( ) const
inlineoverridevirtualnoexcept

It's not advisable to continue using the connection after this.

Reimplemented from pqxx::failure.

◆ pqxx::deadlock_detected

struct pqxx::deadlock_detected

The ongoing transaction has deadlocked. Retrying it may help.

+ Inheritance diagram for pqxx::deadlock_detected:
+ Collaboration diagram for pqxx::deadlock_detected:

Public Member Functions

PQXX_ZARGS deadlock_detected (std::string const &whatarg, std::string const &q, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::transaction_rollback
PQXX_ZARGS transaction_rollback (std::string const &whatarg, std::string const &q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
bool poisons_transaction () const noexcept override
 Some earlier failure broke the transaction. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ deadlock_detected()

PQXX_ZARGS pqxx::deadlock_detected::deadlock_detected ( std::string const &  whatarg,
std::string const &  q,
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::deadlock_detected::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::transaction_rollback.

◆ pqxx::internal_error

struct pqxx::internal_error

Internal error in libpqxx library.

+ Inheritance diagram for pqxx::internal_error:
+ Collaboration diagram for pqxx::internal_error:

Public Member Functions

 internal_error (std::string const &, sl=sl::current(), st &&tr=st::current())
 
bool poisons_connection () const noexcept override
 When this happens, all bets are off. It may work, but don't risk it. More...
 
bool poisons_transaction () const noexcept override
 When this happens, all bets are off. It may work, but don't risk it. More...
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ internal_error()

pqxx::internal_error::internal_error ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
explicit

Member Function Documentation

◆ name()

std::string_view pqxx::internal_error::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::failure.

◆ poisons_connection()

bool pqxx::internal_error::poisons_connection ( ) const
inlineoverridevirtualnoexcept

When this happens, all bets are off. It may work, but don't risk it.

Reimplemented from pqxx::failure.

◆ poisons_transaction()

bool pqxx::internal_error::poisons_transaction ( ) const
inlineoverridevirtualnoexcept

When this happens, all bets are off. It may work, but don't risk it.

Reimplemented from pqxx::failure.

◆ pqxx::usage_error

struct pqxx::usage_error

Error in usage of libpqxx library, similar to std::logic_error.

+ Inheritance diagram for pqxx::usage_error:
+ Collaboration diagram for pqxx::usage_error:

Public Member Functions

 usage_error (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
bool poisons_transaction () const noexcept override
 Your transaction will probably still work, but something is badly wrong. More...
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ usage_error()

pqxx::usage_error::usage_error ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::usage_error::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::failure.

◆ poisons_transaction()

bool pqxx::usage_error::poisons_transaction ( ) const
inlineoverridevirtualnoexcept

Your transaction will probably still work, but something is badly wrong.

Reimplemented from pqxx::failure.

◆ pqxx::argument_error

struct pqxx::argument_error

Invalid argument passed to libpqxx, similar to std::invalid_argument.

+ Inheritance diagram for pqxx::argument_error:
+ Collaboration diagram for pqxx::argument_error:

Public Member Functions

 argument_error (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 
virtual bool poisons_transaction () const noexcept
 Does this type of error make an ongoing dbtransaction unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ argument_error()

pqxx::argument_error::argument_error ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::argument_error::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::failure.

◆ pqxx::conversion_error

struct pqxx::conversion_error

Value conversion failed, e.g. when converting "Hello" to int.

+ Inheritance diagram for pqxx::conversion_error:
+ Collaboration diagram for pqxx::conversion_error:

Public Member Functions

 conversion_error (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 
virtual bool poisons_transaction () const noexcept
 Does this type of error make an ongoing dbtransaction unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ conversion_error()

pqxx::conversion_error::conversion_error ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::conversion_error::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::failure.

Reimplemented in pqxx::conversion_overrun, and pqxx::unexpected_null.

◆ pqxx::unexpected_null

struct pqxx::unexpected_null

Could not convert null value: target type does not support null.

+ Inheritance diagram for pqxx::unexpected_null:
+ Collaboration diagram for pqxx::unexpected_null:

Public Member Functions

 unexpected_null (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::conversion_error
 conversion_error (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 
virtual bool poisons_transaction () const noexcept
 Does this type of error make an ongoing dbtransaction unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ unexpected_null()

pqxx::unexpected_null::unexpected_null ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::unexpected_null::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::conversion_error.

◆ pqxx::conversion_overrun

struct pqxx::conversion_overrun

Could not convert value to string: not enough buffer space.

+ Inheritance diagram for pqxx::conversion_overrun:
+ Collaboration diagram for pqxx::conversion_overrun:

Public Member Functions

 conversion_overrun (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::conversion_error
 conversion_error (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 
virtual bool poisons_transaction () const noexcept
 Does this type of error make an ongoing dbtransaction unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ conversion_overrun()

pqxx::conversion_overrun::conversion_overrun ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::conversion_overrun::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::conversion_error.

◆ pqxx::range_error

struct pqxx::range_error

Something is out of range, similar to std::out_of_range.

+ Inheritance diagram for pqxx::range_error:
+ Collaboration diagram for pqxx::range_error:

Public Member Functions

 range_error (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 
virtual bool poisons_transaction () const noexcept
 Does this type of error make an ongoing dbtransaction unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ range_error()

pqxx::range_error::range_error ( std::string const &  whatarg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::range_error::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::failure.

Reimplemented in pqxx::unexpected_rows.

◆ pqxx::unexpected_rows

struct pqxx::unexpected_rows

Query returned an unexpected number of rows.

+ Inheritance diagram for pqxx::unexpected_rows:
+ Collaboration diagram for pqxx::unexpected_rows:

Public Member Functions

 unexpected_rows (std::string const &msg, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::range_error
 range_error (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 
virtual bool poisons_transaction () const noexcept
 Does this type of error make an ongoing dbtransaction unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ unexpected_rows()

pqxx::unexpected_rows::unexpected_rows ( std::string const &  msg,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::unexpected_rows::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::range_error.

◆ pqxx::feature_not_supported

struct pqxx::feature_not_supported

Database feature not supported in current setup.

+ Inheritance diagram for pqxx::feature_not_supported:
+ Collaboration diagram for pqxx::feature_not_supported:

Public Member Functions

PQXX_ZARGS feature_not_supported (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
bool poisons_connection () const noexcept override
 It all depends on the details, but this can break your connection. More...
 
bool poisons_transaction () const noexcept override
 If this poisons your connection, it also poisons your transaction. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ feature_not_supported()

PQXX_ZARGS pqxx::feature_not_supported::feature_not_supported ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::feature_not_supported::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

◆ poisons_connection()

bool pqxx::feature_not_supported::poisons_connection ( ) const
inlineoverridevirtualnoexcept

It all depends on the details, but this can break your connection.

Reimplemented from pqxx::failure.

◆ poisons_transaction()

bool pqxx::feature_not_supported::poisons_transaction ( ) const
inlineoverridevirtualnoexcept

If this poisons your connection, it also poisons your transaction.

Reimplemented from pqxx::sql_error.

◆ pqxx::data_exception

struct pqxx::data_exception

Error in data provided to SQL statement.

+ Inheritance diagram for pqxx::data_exception:
+ Collaboration diagram for pqxx::data_exception:

Public Member Functions

PQXX_ZARGS data_exception (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ data_exception()

PQXX_ZARGS pqxx::data_exception::data_exception ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::data_exception::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

◆ pqxx::integrity_constraint_violation

struct pqxx::integrity_constraint_violation
+ Inheritance diagram for pqxx::integrity_constraint_violation:
+ Collaboration diagram for pqxx::integrity_constraint_violation:

Public Member Functions

PQXX_ZARGS integrity_constraint_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ integrity_constraint_violation()

PQXX_ZARGS pqxx::integrity_constraint_violation::integrity_constraint_violation ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::integrity_constraint_violation::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

Reimplemented in pqxx::check_violation, pqxx::unique_violation, pqxx::foreign_key_violation, pqxx::not_null_violation, and pqxx::restrict_violation.

◆ pqxx::restrict_violation

struct pqxx::restrict_violation
+ Inheritance diagram for pqxx::restrict_violation:
+ Collaboration diagram for pqxx::restrict_violation:

Public Member Functions

PQXX_ZARGS restrict_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::integrity_constraint_violation
PQXX_ZARGS integrity_constraint_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ restrict_violation()

PQXX_ZARGS pqxx::restrict_violation::restrict_violation ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::restrict_violation::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::integrity_constraint_violation.

◆ pqxx::not_null_violation

struct pqxx::not_null_violation
+ Inheritance diagram for pqxx::not_null_violation:
+ Collaboration diagram for pqxx::not_null_violation:

Public Member Functions

PQXX_ZARGS not_null_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::integrity_constraint_violation
PQXX_ZARGS integrity_constraint_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ not_null_violation()

PQXX_ZARGS pqxx::not_null_violation::not_null_violation ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::not_null_violation::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::integrity_constraint_violation.

◆ pqxx::foreign_key_violation

struct pqxx::foreign_key_violation
+ Inheritance diagram for pqxx::foreign_key_violation:
+ Collaboration diagram for pqxx::foreign_key_violation:

Public Member Functions

PQXX_ZARGS foreign_key_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::integrity_constraint_violation
PQXX_ZARGS integrity_constraint_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ foreign_key_violation()

PQXX_ZARGS pqxx::foreign_key_violation::foreign_key_violation ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::foreign_key_violation::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::integrity_constraint_violation.

◆ pqxx::unique_violation

struct pqxx::unique_violation
+ Inheritance diagram for pqxx::unique_violation:
+ Collaboration diagram for pqxx::unique_violation:

Public Member Functions

PQXX_ZARGS unique_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::integrity_constraint_violation
PQXX_ZARGS integrity_constraint_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ unique_violation()

PQXX_ZARGS pqxx::unique_violation::unique_violation ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::unique_violation::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::integrity_constraint_violation.

◆ pqxx::check_violation

struct pqxx::check_violation
+ Inheritance diagram for pqxx::check_violation:
+ Collaboration diagram for pqxx::check_violation:

Public Member Functions

PQXX_ZARGS check_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::integrity_constraint_violation
PQXX_ZARGS integrity_constraint_violation (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ check_violation()

PQXX_ZARGS pqxx::check_violation::check_violation ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::check_violation::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::integrity_constraint_violation.

◆ pqxx::invalid_cursor_state

struct pqxx::invalid_cursor_state
+ Inheritance diagram for pqxx::invalid_cursor_state:
+ Collaboration diagram for pqxx::invalid_cursor_state:

Public Member Functions

PQXX_ZARGS invalid_cursor_state (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ invalid_cursor_state()

PQXX_ZARGS pqxx::invalid_cursor_state::invalid_cursor_state ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::invalid_cursor_state::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

◆ pqxx::invalid_sql_statement_name

struct pqxx::invalid_sql_statement_name
+ Inheritance diagram for pqxx::invalid_sql_statement_name:
+ Collaboration diagram for pqxx::invalid_sql_statement_name:

Public Member Functions

PQXX_ZARGS invalid_sql_statement_name (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ invalid_sql_statement_name()

PQXX_ZARGS pqxx::invalid_sql_statement_name::invalid_sql_statement_name ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::invalid_sql_statement_name::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

◆ pqxx::invalid_cursor_name

struct pqxx::invalid_cursor_name
+ Inheritance diagram for pqxx::invalid_cursor_name:
+ Collaboration diagram for pqxx::invalid_cursor_name:

Public Member Functions

PQXX_ZARGS invalid_cursor_name (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ invalid_cursor_name()

PQXX_ZARGS pqxx::invalid_cursor_name::invalid_cursor_name ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::invalid_cursor_name::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

◆ pqxx::syntax_error

struct pqxx::syntax_error
+ Inheritance diagram for pqxx::syntax_error:
+ Collaboration diagram for pqxx::syntax_error:

Public Member Functions

PQXX_ZARGS syntax_error (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, int pos=-1, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
constexpr int error_pos () const noexcept
 Approximate position in statement where the error occurred, or -1. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Public Attributes

int error_position
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ syntax_error()

PQXX_ZARGS pqxx::syntax_error::syntax_error ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
int  pos = -1,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ error_pos()

constexpr int pqxx::syntax_error::error_pos ( ) const
inlineconstexprnoexcept

Approximate position in statement where the error occurred, or -1.

The special value -1 is for cases where the error has no useful location in the SQL statement to indicate.

◆ name()

std::string_view pqxx::syntax_error::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

Reimplemented in pqxx::undefined_table, pqxx::undefined_function, and pqxx::undefined_column.

Member Data Documentation

◆ error_position

int pqxx::syntax_error::error_position

◆ pqxx::undefined_column

struct pqxx::undefined_column
+ Inheritance diagram for pqxx::undefined_column:
+ Collaboration diagram for pqxx::undefined_column:

Public Member Functions

PQXX_ZARGS undefined_column (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::syntax_error
PQXX_ZARGS syntax_error (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, int pos=-1, sl loc=sl::current(), st &&tr=st::current())
 
constexpr int error_pos () const noexcept
 Approximate position in statement where the error occurred, or -1. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Public Attributes inherited from pqxx::syntax_error
int error_position
 
- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ undefined_column()

PQXX_ZARGS pqxx::undefined_column::undefined_column ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::undefined_column::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::syntax_error.

◆ pqxx::undefined_function

struct pqxx::undefined_function
+ Inheritance diagram for pqxx::undefined_function:
+ Collaboration diagram for pqxx::undefined_function:

Public Member Functions

PQXX_ZARGS undefined_function (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::syntax_error
PQXX_ZARGS syntax_error (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, int pos=-1, sl loc=sl::current(), st &&tr=st::current())
 
constexpr int error_pos () const noexcept
 Approximate position in statement where the error occurred, or -1. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Public Attributes inherited from pqxx::syntax_error
int error_position
 
- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ undefined_function()

PQXX_ZARGS pqxx::undefined_function::undefined_function ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::undefined_function::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::syntax_error.

◆ pqxx::undefined_table

struct pqxx::undefined_table
+ Inheritance diagram for pqxx::undefined_table:
+ Collaboration diagram for pqxx::undefined_table:

Public Member Functions

PQXX_ZARGS undefined_table (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::syntax_error
PQXX_ZARGS syntax_error (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, int pos=-1, sl loc=sl::current(), st &&tr=st::current())
 
constexpr int error_pos () const noexcept
 Approximate position in statement where the error occurred, or -1. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Public Attributes inherited from pqxx::syntax_error
int error_position
 
- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ undefined_table()

PQXX_ZARGS pqxx::undefined_table::undefined_table ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::undefined_table::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::syntax_error.

◆ pqxx::insufficient_privilege

struct pqxx::insufficient_privilege
+ Inheritance diagram for pqxx::insufficient_privilege:
+ Collaboration diagram for pqxx::insufficient_privilege:

Public Member Functions

PQXX_ZARGS insufficient_privilege (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ insufficient_privilege()

PQXX_ZARGS pqxx::insufficient_privilege::insufficient_privilege ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::insufficient_privilege::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

◆ pqxx::insufficient_resources

struct pqxx::insufficient_resources

Resource shortage on the server.

+ Inheritance diagram for pqxx::insufficient_resources:
+ Collaboration diagram for pqxx::insufficient_resources:

Public Member Functions

PQXX_ZARGS insufficient_resources (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ insufficient_resources()

PQXX_ZARGS pqxx::insufficient_resources::insufficient_resources ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::insufficient_resources::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

Reimplemented in pqxx::server_out_of_memory, and pqxx::disk_full.

◆ pqxx::disk_full

struct pqxx::disk_full
+ Inheritance diagram for pqxx::disk_full:
+ Collaboration diagram for pqxx::disk_full:

Public Member Functions

PQXX_ZARGS disk_full (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::insufficient_resources
PQXX_ZARGS insufficient_resources (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ disk_full()

PQXX_ZARGS pqxx::disk_full::disk_full ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::disk_full::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::insufficient_resources.

◆ pqxx::server_out_of_memory

struct pqxx::server_out_of_memory
+ Inheritance diagram for pqxx::server_out_of_memory:
+ Collaboration diagram for pqxx::server_out_of_memory:

Public Member Functions

PQXX_ZARGS server_out_of_memory (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::insufficient_resources
PQXX_ZARGS insufficient_resources (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ server_out_of_memory()

PQXX_ZARGS pqxx::server_out_of_memory::server_out_of_memory ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::server_out_of_memory::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::insufficient_resources.

◆ pqxx::too_many_connections

struct pqxx::too_many_connections
+ Inheritance diagram for pqxx::too_many_connections:
+ Collaboration diagram for pqxx::too_many_connections:

Public Member Functions

 too_many_connections (std::string const &err, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::broken_connection
 broken_connection (sl loc=sl::current(), st &&tr=st::current())
 
 broken_connection (std::string const &whatarg, sl loc=sl::current(), st &&tr=st::current())
 
bool poisons_connection () const noexcept override
 By its nature, this type of error makes the connection unusable. More...
 
bool poisons_transaction () const noexcept override
 When the connection breaks, so will an ongoing transaction. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ too_many_connections()

pqxx::too_many_connections::too_many_connections ( std::string const &  err,
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::too_many_connections::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::broken_connection.

◆ pqxx::plpgsql_error

struct pqxx::plpgsql_error

PL/pgSQL error.

Exceptions derived from this class are errors from PL/pgSQL procedures.

+ Inheritance diagram for pqxx::plpgsql_error:
+ Collaboration diagram for pqxx::plpgsql_error:

Public Member Functions

PQXX_ZARGS plpgsql_error (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ plpgsql_error()

PQXX_ZARGS pqxx::plpgsql_error::plpgsql_error ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::plpgsql_error::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::sql_error.

Reimplemented in pqxx::plpgsql_too_many_rows, pqxx::plpgsql_no_data_found, and pqxx::plpgsql_raise.

◆ pqxx::plpgsql_raise

struct pqxx::plpgsql_raise

Exception raised in PL/pgSQL procedure.

+ Inheritance diagram for pqxx::plpgsql_raise:
+ Collaboration diagram for pqxx::plpgsql_raise:

Public Member Functions

PQXX_ZARGS plpgsql_raise (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::plpgsql_error
PQXX_ZARGS plpgsql_error (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ plpgsql_raise()

PQXX_ZARGS pqxx::plpgsql_raise::plpgsql_raise ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::plpgsql_raise::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::plpgsql_error.

◆ pqxx::plpgsql_no_data_found

struct pqxx::plpgsql_no_data_found
+ Inheritance diagram for pqxx::plpgsql_no_data_found:
+ Collaboration diagram for pqxx::plpgsql_no_data_found:

Public Member Functions

PQXX_ZARGS plpgsql_no_data_found (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::plpgsql_error
PQXX_ZARGS plpgsql_error (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ plpgsql_no_data_found()

PQXX_ZARGS pqxx::plpgsql_no_data_found::plpgsql_no_data_found ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::plpgsql_no_data_found::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::plpgsql_error.

◆ pqxx::plpgsql_too_many_rows

struct pqxx::plpgsql_too_many_rows
+ Inheritance diagram for pqxx::plpgsql_too_many_rows:
+ Collaboration diagram for pqxx::plpgsql_too_many_rows:

Public Member Functions

PQXX_ZARGS plpgsql_too_many_rows (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
std::string_view name () const noexcept override
 The name of this exception type: "failure", "sql_error", etc. More...
 
- Public Member Functions inherited from pqxx::plpgsql_error
PQXX_ZARGS plpgsql_error (std::string const &err, std::string const &Q={}, std::string const &sqlstate={}, sl loc=sl::current(), st &&tr=st::current())
 
- Public Member Functions inherited from pqxx::sql_error
PQXX_ZARGS sql_error (std::string const &whatarg={}, std::string const &stmt={}, std::string const &sqls={}, sl loc=sl::current(), st &&tr=st::current())
 
 sql_error (sql_error const &other)=default
 
 sql_error (sql_error &&other)=default
 
 ~sql_error () override=default
 
sql_erroroperator= (sql_error const &other)=default
 
sql_erroroperator= (sql_error &&other)=default
 
bool poisons_transaction () const noexcept override
 If a transaction was ongoing, an SQL error will break it. More...
 
- Public Member Functions inherited from pqxx::failure
 failure (failure const &)=default
 
 failure (failure &&)=default
 
 failure (sl loc=sl::current(), st tr=st::current())
 
 failure (std::string whatarg, sl loc=sl::current(), st tr=st::current())
 
 ~failure () noexcept override
 
failureoperator= (failure const &)=default
 
failureoperator= (failure &&)=default
 
PQXX_PURE char const * what () const noexcept override
 Error message. More...
 
PQXX_PURE sl const & location () const noexcept
 Best known std::source_location for where the error occurred. More...
 
PQXX_PURE std::shared_ptr< st const > trace () const noexcept
 If available in this compiler, a std::stacktrace of this exception. More...
 
PQXX_PURE std::string_view sqlstate () const noexcept
 SQLSTATE error code, or empty string if unavailable. More...
 
PQXX_PURE std::string_view query () const noexcept
 SQL statement that encountered the error, if applicable; or empty string. More...
 
virtual bool poisons_connection () const noexcept
 Does this type of error make the current connection unusable? More...
 

Additional Inherited Members

- Protected Member Functions inherited from pqxx::failure
 failure (std::string whatarg, std::string stat, std::string sqls, sl loc=sl::current(), st tr=st::current())
 

Constructor & Destructor Documentation

◆ plpgsql_too_many_rows()

PQXX_ZARGS pqxx::plpgsql_too_many_rows::plpgsql_too_many_rows ( std::string const &  err,
std::string const &  Q = {},
std::string const &  sqlstate = {},
sl  loc = sl::current(),
st &&  tr = st::current() 
)
inlineexplicit

Member Function Documentation

◆ name()

std::string_view pqxx::plpgsql_too_many_rows::name ( ) const
overridevirtualnoexcept

The name of this exception type: "failure", "sql_error", etc.

Do not count on this being exact, or eternal as libpqxx evolves. There can be mistakes, names may change, new exception subclasses show up during libpqxx development.

Note
If you need to check whether an exception you've caught is of a specific type, e.g. pqxx::deadlock_detected, do not use name() for this, since its answer may change as libpqxx evolves. Instead, use something like:
try
{
// ...
}
catch (pqxx::failure const &e)
{
auto const deadlock = dynamic_cast<pqxx::deadlock_detected const *>(&e);
if (deadlock == nullptr)
{
// `e` is some other type of exception, not a deadlock.
}
else
{
// `e` is a `deadlock_detected` error, and `deadlock` points to it
// by its more specific static type.
}
}

Reimplemented from pqxx::plpgsql_error.