diff mbox series

[OSSTEST,3/7] mg-schema-test-database: posgtres compat: Cope with schema name

Message ID 20210427180033.9439-4-iwj@xenproject.org (mailing list archive)
State New
Headers show
Series Fixes for postgresql etc. upgrade | expand

Commit Message

Ian Jackson April 27, 2021, 6 p.m. UTC
The dump now (postgresql 11) contains lots of "public." which made
these regexps not match.

Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 mg-schema-test-database | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/mg-schema-test-database b/mg-schema-test-database
index b49fbecf..b5906d70 100755
--- a/mg-schema-test-database
+++ b/mg-schema-test-database
@@ -377,9 +377,10 @@  END
 
 	# What tables are there ?
 	perl -ne <$t.schema >$t.tablevars '
-		if (m/^CREATE SEQUENCE (\w+)/) {
+		BEGIN { $sch_re = qr{(?:public\.)?}; }
+		if (m/^CREATE SEQUENCE $sch_re(\w+)/) {
 			print "sequences+=\" $1\"\n";
-		} elsif (m/^CREATE TABLE (\w+)/) {
+		} elsif (m/^CREATE TABLE $sch_re(\w+)\s+/) {
 			$table=$1;
 		} elsif (m/^\s*flight\s+integer\s/) {
 			die unless $table;