Fix test failuers on later Postgres releases.
authorDavid E. Wheeler <david@justatheory.com>
Fri, 7 Dec 2012 00:12:43 +0000 (16:12 -0800)
committerDavid E. Wheeler <david@justatheory.com>
Fri, 7 Dec 2012 00:12:43 +0000 (16:12 -0800)
In 2d7f462e2a3ccc0ee370e10aac8811c33fbde999, Greg changed the calls to `ALTER
SEQUENCE` so that they work for older versions of PostgreSQL. However, it
broke newer versions (I'm testing on 9.2.2). It looks like the `START` clause
was added in 8.4, so let's use it as we did before for 8.4 and higher and
leave it out for 8.3 and older.

t/20-postgres.t

index 4595e210a5f51993e62163d72dda8b0cbc77a50e..a4d83800c2660893ae21617b516f63fd226e7171 100644 (file)
@@ -316,9 +316,14 @@ like $bct->ctl('bucardo kick sync pgtest3 0'),
 $bct->check_for_row([[1],[2],[3],[7]], [qw/A B C D/]);
 
 ## Change sequence information, make sure it gets out to everyone
-$dbhA->do('alter sequence bucardo_test_seq1 restart 25 minvalue 10 maxvalue 8675');
+if ($dbhA->{pg_server_version} < 80400) {
+    $dbhA->do('alter sequence bucardo_test_seq1 restart 25 minvalue 10 maxvalue 8675');
+    $dbhB->do('alter sequence bucardo_test_seq2 restart 250 minvalue 100 maxvalue 86753');
+} else {
+    $dbhA->do('alter sequence bucardo_test_seq1 start 20 restart 25 minvalue 10 maxvalue 8675');
+    $dbhB->do('alter sequence bucardo_test_seq2 start 200 restart 250 minvalue 100 maxvalue 86753');
+}
 $dbhA->commit();
-$dbhB->do('alter sequence bucardo_test_seq2 restart 250 minvalue 100 maxvalue 86753');
 $dbhB->commit();
 $dbhC->do(q{SELECT setval('bucardo_test_seq3', 12345)});
 $dbhC->commit();