@@ -193,6 +193,7 @@ package check_postgres;
193193 ' no-match-slot' => q{ No matching replication slots found due to exclusion/inclusion options} ,
194194 ' no-match-slotok' => q{ No replication slots found} ,
195195 ' no-parse-psql' => q{ Could not parse psql output!} ,
196+ ' no-role' => q{ Need psql 9.6 or higher to use --role} ,
196197 ' no-time-hires' => q{ Cannot find Time::HiRes, needed if 'showtime' is true} ,
197198 ' opt-output-invalid' => q{ Invalid output: must be 'nagios' or 'mrtg' or 'simple' or 'cacti'} ,
198199 ' opt-psql-badpath' => q{ Invalid psql argument: must be full path to a file named psql} ,
@@ -1695,6 +1696,7 @@ package check_postgres;
16951696 ' dbuser|u|dbuser1|u1=s@' ,
16961697 ' dbpass|dbpass1=s@' ,
16971698 ' dbservice|dbservice1=s@' ,
1699+ ' role=s' ,
16981700
16991701 ' PGBINDIR=s' ,
17001702 ' PSQL=s' ,
@@ -3083,6 +3085,14 @@ sub run_command {
30833085 local $SIG {ALRM } = sub { die " Timed out\n " };
30843086 alarm 0;
30853087
3088+ if ($opt {role }) {
3089+ if ($psql_version < 9.6) {
3090+ ndie msg(' no-role' )
3091+ }
3092+ else {
3093+ push @args , ' -c' , " SET ROLE $opt {role}" ;
3094+ }
3095+ }
30863096 push @args , ' -c' , $string ;
30873097
30883098 $VERBOSE >= 3 and warn Dumper \@args ;
0 commit comments