fixed PostgreSQL tests

This commit is contained in:
2026-01-01 17:08:20 +01:00
parent 7cb64515bd
commit a79d50e6e8
17 changed files with 230 additions and 329 deletions
@@ -252,9 +252,10 @@ utils::result<std::vector<object::attribute>, utils::error> postgres_connection:
}
utils::result<bool, utils::error> postgres_connection::exists(const std::string &schema_name, const std::string &table_name) {
const std::string stmt(
"SELECT 1 FROM information_schema.tables WHERE table_schema = '" + schema_name + "' AND table_name = '" + table_name
+ "'");
std::string stmt( "SELECT 1 FROM information_schema.tables WHERE table_name = '" + table_name + "'");
if (!schema_name.empty()) {
stmt += " AND table_schema = '" + schema_name + "'";
}
PGresult *res = PQexec(conn_, stmt.c_str());