Remove manual connection string parsing from PostgreSQL backend

Use connection_parameters instead for simplicity and correctness: this
fixes the equivalent of #1175 in this backend too.
This commit is contained in:
Vadim Zeitlin
2024-11-09 16:10:16 +01:00
parent 1e084138aa
commit 1a6607bc2f
4 changed files with 43 additions and 99 deletions

View File

@@ -130,6 +130,17 @@ struct oid_table_creator : public table_creator_base
}
};
TEST_CASE("PostgreSQL connection string", "[postgresql][connstring]")
{
// There are no required parts in libpq connection string, so we can only
// test that invalid options are detected.
CHECK_THROWS_WITH(soci::session(backEnd, "bloordyblop=1"),
Catch::Contains(R"(invalid connection option "bloordyblop")"));
CHECK_THROWS_WITH(soci::session(backEnd, "sslmode=bloordyblop"),
Catch::Contains(R"(invalid sslmode value: "bloordyblop")"));
}
// ROWID test
// Note: in PostgreSQL, there is no ROWID, there is OID.
// It is still provided as a separate type for "portability",