aboutsummaryrefslogtreecommitdiff
path: root/common/bulk/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-06-29 13:20:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-06-29 13:20:30 +0200
commit3231650c50fc943301b3c76fe7d1f7b806f0cc62 (patch)
treed3575c1ffc1ee12a07634259a9e8a8b87ab0e670 /common/bulk/driver.cxx
parentd776aad4d4abb8eabd240621eb3d13b59a5b17d8 (diff)
Add support for bulk operations in PostgreSQL 14
Diffstat (limited to 'common/bulk/driver.cxx')
-rw-r--r--common/bulk/driver.cxx18
1 files changed, 16 insertions, 2 deletions
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<database> 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<object> 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)