summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorGreg Sabino Mullane2010-02-04 15:58:41 +0000
committerGreg Sabino Mullane2010-02-04 15:58:41 +0000
commita0749f03ca2ca4ca370287e7c695cf7d8509149f (patch)
treedc0578a98623f7d8af1570506d8744080786bf48 /check_postgres.pl
parentb63d744c2ed55fc848215789323739741c27082c (diff)
Add noowner option or same_schema.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl63
1 files changed, 37 insertions, 26 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index 69700508e..8b75c471c 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -4537,7 +4537,7 @@ sub check_same_schema {
my %filter;
if (exists $opt{warning} and length $opt{warning}) {
for my $phrase (split /\s+/ => $opt{warning}) {
- for my $type (qw/schema user table view index sequence constraint trigger function perm language/) {
+ for my $type (qw/schema user table view index sequence constraint trigger function perm language owner/) {
if ($phrase =~ /^no${type}s?$/i) {
$filter{"no${type}s"} = 1;
}
@@ -4944,14 +4944,16 @@ SQL
}
## Do the schemas have same owner and permissions?
- if ($thing{1}{schemas}{$name}{owner} ne $thing{2}{schemas}{$name}{owner}) {
- push @{$fail{schemas}{diffowners}} =>
- [
- $name,
- $thing{1}{schemas}{$name}{owner},
- $thing{2}{schemas}{$name}{owner},
+ if (! exists $filter{noowners}) {
+ if ($thing{1}{schemas}{$name}{owner} ne $thing{2}{schemas}{$name}{owner}) {
+ push @{$fail{schemas}{diffowners}} =>
+ [
+ $name,
+ $thing{1}{schemas}{$name}{owner},
+ $thing{2}{schemas}{$name}{owner},
];
- $failcount++;
+ $failcount++;
+ }
}
if ($thing{1}{schemas}{$name}{acl} ne $thing{2}{schemas}{$name}{acl}) {
@@ -5015,13 +5017,16 @@ SQL
}
## Do the tables have same owner and permissions?
- if ($thing{1}{tables}{$name}{owner} ne $thing{2}{tables}{$name}{owner}) {
- push @{$fail{tables}{diffowners}} =>
- [$name,
- $thing{1}{tables}{$name}{owner},
- $thing{2}{tables}{$name}{owner},
+ if (! exists $filter{noowners}) {
+ if ($thing{1}{tables}{$name}{owner} ne $thing{2}{tables}{$name}{owner}) {
+ push @{$fail{tables}{diffowners}} =>
+ [
+ $name,
+ $thing{1}{tables}{$name}{owner},
+ $thing{2}{tables}{$name}{owner},
];
- $failcount++;
+ $failcount++;
+ }
}
if ($thing{1}{tables}{$name}{acl} ne $thing{2}{tables}{$name}{acl}) {
@@ -5085,13 +5090,16 @@ SQL
}
## Do the sequences have same owner and permissions?
- if ($thing{1}{sequences}{$name}{owner} ne $thing{2}{sequences}{$name}{owner}) {
- push @{$fail{sequences}{diffowners}} =>
- [$name,
- $thing{1}{sequences}{$name}{owner},
- $thing{2}{sequences}{$name}{owner},
+ if (! exists $filter{noowners}) {
+ if ($thing{1}{sequences}{$name}{owner} ne $thing{2}{sequences}{$name}{owner}) {
+ push @{$fail{sequences}{diffowners}} =>
+ [
+ $name,
+ $thing{1}{sequences}{$name}{owner},
+ $thing{2}{sequences}{$name}{owner},
];
- $failcount++;
+ $failcount++;
+ }
}
if ($thing{1}{sequences}{$name}{acl} ne $thing{2}{sequences}{$name}{acl}) {
@@ -5154,13 +5162,16 @@ SQL
}
## Do the views have same owner and permissions?
- if ($thing{1}{views}{$name}{owner} ne $thing{2}{views}{$name}{owner}) {
- push @{$fail{views}{diffowners}} =>
- [$name,
- $thing{1}{views}{$name}{owner},
- $thing{2}{views}{$name}{owner},
+ if (! exists $filter{noowners}) {
+ if ($thing{1}{views}{$name}{owner} ne $thing{2}{views}{$name}{owner}) {
+ push @{$fail{views}{diffowners}} =>
+ [
+ $name,
+ $thing{1}{views}{$name}{owner},
+ $thing{2}{views}{$name}{owner},
];
- $failcount++;
+ $failcount++;
+ }
}
if ($thing{1}{views}{$name}{acl} ne $thing{2}{views}{$name}{acl}) {