[check_postgres] tgiscontraint is not available in 9.0

Guillaume Lelarge guillaume at lelarge.info
Wed Jan 19 15:07:25 UTC 2011


Hi,

A quick patch for same_schema action. It tris to use tgisconstraint on
pg_trigger but this column is not available anymore in 9.0. This patch uses
tgconstraint when release is 9.0+.

Regards.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com
-------------- next part --------------
From c1b66daa2e8e0d802fc9d8a5c569e74fdacc2e61 Mon Sep 17 00:00:00 2001
From: Guillaume Lelarge <guillaume at lelarge.info>
Date: Wed, 19 Jan 2011 16:04:07 +0100
Subject: [PATCH] tgisconstraint is not available on 9.0+

---
 check_postgres.pl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/check_postgres.pl b/check_postgres.pl
index 794df6e..7c7bbc3 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -5267,7 +5267,9 @@ JOIN pg_class c ON (c.oid = tgrelid)
 JOIN pg_proc p ON (p.oid = tgfoid)
 WHERE NOT tgisconstraint
 }; ## constraints checked separately
-            $info = run_command($SQL, { dbuser => $opt{dbuser}[$x-1], dbnumber => $x } );
+            (my $SQL2 = $SQL) =~ s/NOT tgisconstraint/tgconstraint = 0/;
+
+            $info = run_command($SQL, { dbuser => $opt{dbuser}[$x-1], dbnumber => $x, version  => [ ">8.2 $SQL2" ] } );
             for $db (@{$info->{db}}) {
                 for my $r (@{$db->{slurp}}) {
                     my ($name,$table,$func,$args) = @$r{qw/ tgname relname proname proargtypes /};
-- 
1.7.1


More information about the Check_postgres mailing list