check_postgres
check_postgres copied to clipboard
same_schema name filtering does not work
ID: 91 Version: unspecified Date: 2011-11-23 09:07 EST Author: Peter Eisentraut ([email protected])
Database test1:
create schema foo;
create table foo.bar1(a int);
create table foo.bar2(a int);
Database test2:
create schema foo;
create table foo.bar1(a int);
Now I would like to exclude schema "foo" from comparison:
$ check_postgres_same_schema -db test1,test2 --filter='noschema=foo'
POSTGRES_SAME_SCHEMA CRITICAL: (databases:test1,test2) Databases were
different. Items not matched: 1 | time=1.85s
DB 1: port=5432 host=<none> dbname=test1 user=postgres
DB 1: PG version: 8.4.9
DB 1: Total objects: 31
DB 2: port=5432 host=<none> dbname=test2 user=postgres
DB 2: PG version: 8.4.9
DB 2: Total objects: 29
Table "foo.bar2" does not exist on all databases:
Exists on: 1
Missing on: 2
Or just the table:
$ check_postgres_same_schema -db test1,test2 --filter='notable=bar'
POSTGRES_SAME_SCHEMA CRITICAL: (databases:test1,test2) Databases were
different. Items not matched: 1 | time=1.88s
DB 1: port=5432 host=<none> dbname=test1 user=postgres
DB 1: PG version: 8.4.9
DB 1: Total objects: 31
DB 2: port=5432 host=<none> dbname=test2 user=postgres
DB 2: PG version: 8.4.9
DB 2: Total objects: 29
Table "foo.bar2" does not exist on all databases:
Exists on: 1
Missing on: 2
This "radical" solution works:
$ check_postgres_same_schema -db test1,test2 --filter='notables'
POSTGRES_SAME_SCHEMA OK: (databases:test1,test2) All databases have identical
items | time=1.70s
But this doesn't:
$ check_postgres_same_schema -db test1,test2 --filter='noschemas'
POSTGRES_SAME_SCHEMA CRITICAL: (databases:test1,test2) Databases were
different. Items not matched: 1 | time=1.75s
DB 1: port=5432 host=<none> dbname=test1 user=postgres
DB 1: PG version: 8.4.9
DB 1: Total objects: 27
DB 2: port=5432 host=<none> dbname=test2 user=postgres
DB 2: PG version: 8.4.9
DB 2: Total objects: 25
Table "foo.bar2" does not exist on all databases:
Exists on: 1
Missing on: 2
It's somewhat unclear what the "schema" filtering option does anyway. In older
releases I was able to compare just the public schema by using
--exclude='^(?!public)'. I was hoping that noschema=regex would provide
that, but then 'noschemas' by itself would make little sense. This should also
be clarified.