summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorGreg2009-05-29 19:01:58 +0000
committerGreg2009-05-29 19:01:58 +0000
commit1844a80b57667f3aca6d8869d9612312b92c2a41 (patch)
tree8fda650bcb1f71e2d87cfab29047153a986953d2 /check_postgres.pl
parent8e21f8368420c3619aabb03886fa582fb97a933a (diff)
Allow constraint exclusions for same_schema.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl41
1 files changed, 21 insertions, 20 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index 4651112ce..7d8b82fa5 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -4269,7 +4269,6 @@ sub check_same_schema {
$filter{nofuncbody} = 1;
}
}
-
}
my (%thing,$info);
@@ -4391,26 +4390,28 @@ sub check_same_schema {
## Get a list of all constraints
## We'll use information_schema for this one too
- $SQL = q{SELECT constraint_schema, constraint_name, table_schema, table_name }
- . q{FROM information_schema.constraint_table_usage};
- $info = run_command($SQL, { dbnumber => $x } );
- for $db (@{$info->{db}}) {
- while ($db->{slurp} =~ /^\s*(.+?)\s+\| (.+?)\s+\| (.+?)\s+\| (.+?)\s*$/gmo) {
- $thing{$x}{constraints}{"$1.$2"} = "$3.$4";
+ if (! exists $filter{noconstraints}) {
+ $SQL = q{SELECT constraint_schema, constraint_name, table_schema, table_name }
+ . q{FROM information_schema.constraint_table_usage};
+ $info = run_command($SQL, { dbnumber => $x } );
+ for $db (@{$info->{db}}) {
+ while ($db->{slurp} =~ /^\s*(.+?)\s+\| (.+?)\s+\| (.+?)\s+\| (.+?)\s*$/gmo) {
+ $thing{$x}{constraints}{"$1.$2"} = "$3.$4";
+ }
}
- }
- $SQL = q{SELECT constraint_schema, constraint_name, table_schema, table_name, column_name }
- . q{FROM information_schema.constraint_column_usage};
- $info = run_command($SQL, { dbnumber => $x } );
- for $db (@{$info->{db}}) {
- while ($db->{slurp} =~ /^\s*(.+?)\s+\| (.+?)\s+\| (.+?)\s+\| (.+?)\s+\| (.+?)\s*$/gmo) {
- my ($cschema,$cname,$tschema,$tname,$col) = ($1,$2,$3,$4,$5);
- if (exists $thing{$x}{colconstraints}{"$cschema.$cname"}) {
- my @oldcols = split / / => $thing{$x}{colconstraints}{"$cschema.$cname"}->[1];
- push @oldcols => $col;
- $col = join ' ' => sort @oldcols;
+ $SQL = q{SELECT constraint_schema, constraint_name, table_schema, table_name, column_name }
+ . q{FROM information_schema.constraint_column_usage};
+ $info = run_command($SQL, { dbnumber => $x } );
+ for $db (@{$info->{db}}) {
+ while ($db->{slurp} =~ /^\s*(.+?)\s+\| (.+?)\s+\| (.+?)\s+\| (.+?)\s+\| (.+?)\s*$/gmo) {
+ my ($cschema,$cname,$tschema,$tname,$col) = ($1,$2,$3,$4,$5);
+ if (exists $thing{$x}{colconstraints}{"$cschema.$cname"}) {
+ my @oldcols = split / / => $thing{$x}{colconstraints}{"$cschema.$cname"}->[1];
+ push @oldcols => $col;
+ $col = join ' ' => sort @oldcols;
+ }
+ $thing{$x}{colconstraints}{"$cschema.$cname"} = ["$tschema.$tname", $col];
}
- $thing{$x}{colconstraints}{"$cschema.$cname"} = ["$tschema.$tname", $col];
}
}
@@ -5298,7 +5299,7 @@ sub check_same_schema {
}
if (exists $fail{functions}{diffbody}) {
for my $name (sort @{$fail{functions}{diffbody}}) {
- $db->{perf} .= " Function body different on 1 than 2: $name ";
+ $db->{perf} .= " Function body different on 1 than 2: $name";
}
}
}