[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 5/7] mg-schema-test-database: posgtres compat: Sequences



Now (postgresql 11) start_value is in a different table.  We don't
really care about it very much and mostly care about the last value,
so we fix that (and launder the for-db comparison dumps).

Signed-off-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
---
 mg-schema-test-database | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/mg-schema-test-database b/mg-schema-test-database
index 26e35c5b..eab0746e 100755
--- a/mg-schema-test-database
+++ b/mg-schema-test-database
@@ -425,16 +425,16 @@ END
         seq_alters=""
         for seq in $sequences; do
                orgseqval=$(psql_query <<END
-                       SELECT start_value || ' ' || last_value FROM $seq
+                       SELECT s.last_value FROM $seq s
 END
                 )
-                read orgstart orglast <<END
+                read orglast <<END
 $orgseqval
 END
                newlast=$(( 10000 * (2 + $orglast / 10000) ))
                 seq_alters+="
                        ALTER SEQUENCE $seq
-                               START WITH $orgstart
+                               START WITH $newlast
                                RESTART WITH $newlast;
 "
         done
@@ -447,7 +447,15 @@ END
 
        # Schema should now be identical to main DB
        $(withtest get_pgdump_cmd) -s -O -x >$t.schema.created
-       diff -u $t.schema.orig $t.schema.created
+
+       for wh in orig created; do
+               perl -pe '
+                       next unless m{^CREATE SEQUENCE }..m{^\)};
+                       $_ = "" if m/^\s*START WITH \d+$/;
+               ' <$t.schema.$wh >$t.schema.$wh-laund
+       done
+
+       diff -u $t.schema.orig-laund $t.schema.created-laund
 
        #---------- mark resources that we are going to borrow ----------
 
-- 
2.20.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.