Recognize another PostgreSQL error as "no_privilege"

Map error 25006 ("cannot execute INSERT in a read-only transaction")
to "no_privilege" category as this means that the database is in
read-only mode, i.e. we don't have the privileges for changing it.
This commit is contained in:
Vadim Zeitlin
2025-06-22 18:33:31 +02:00
parent 6728849259
commit a86de5a91f

View File

@@ -30,7 +30,8 @@ soci_error::error_category postgresql_soci_error::get_error_category() const
{
return connection_error;
}
else if (std::memcmp(sqlstate_, "42501", 5) == 0)
else if (std::memcmp(sqlstate_, "42501", 5) == 0 ||
std::memcmp(sqlstate_, "25006", 5) == 0)
{
return no_privilege;
}