From 3231650c50fc943301b3c76fe7d1f7b806f0cc62 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Jun 2021 13:20:30 +0200 Subject: Add support for bulk operations in PostgreSQL 14 --- common/bulk/driver.cxx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'common/bulk/driver.cxx') diff --git a/common/bulk/driver.cxx b/common/bulk/driver.cxx index 04c440f..33cbbaa 100644 --- a/common/bulk/driver.cxx +++ b/common/bulk/driver.cxx @@ -288,7 +288,9 @@ main (int argc, char* argv[]) { auto_ptr db (create_database (argc, argv)); -#if defined(DATABASE_ORACLE) || defined(DATABASE_MSSQL) +// @@ TODO: bulk operations in PostgreSQL are only available with libpq >= 14. +// +#if defined(DATABASE_ORACLE) || defined(DATABASE_MSSQL) //|| defined(DATABASE_PGSQL) // Test database class API with various forms of containers // and elements (test #6 is a copy). @@ -776,8 +778,16 @@ main (int argc, char* argv[]) } catch (const multiple_exceptions& e) { +#ifndef DATABASE_PGSQL assert (e.attempted () == 3 && e.failed () == 2); assert (e[0] != 0 && e[1] == 0 && e[2] != 0); +#else + // In PosgreSQL no further statements are attempted after the first + // failure. + // + assert (e.attempted () == 1 && e.failed () == 1); + assert (e[0] != 0); +#endif } } @@ -1069,8 +1079,12 @@ main (int argc, char* argv[]) try { + // Some updates may succeed spoiling the version for erase tests. + // + std::vector c (v); + transaction t (db->begin ()); - db->update (v.begin (), v.end ()); + db->update (c.begin (), c.end ()); assert (false); } catch (const multiple_exceptions& e) -- cgit v1.1