#!/usr/bin/perl -w # # relacl.pl : testbed for # use DBI; use strict; my $db = "dbname=template1;port=5432"; my $user = "postgres"; my $pwd = ""; my $dsn = "DBI:Pg:$db"; my $con; my $sql = "select relname, relacl from pg_class where " . "(relkind = 'r' OR relkind = 'S') and relname !~ '^pg_' " . "order by relname"; my $sth; my @row; $con = DBI->connect($dsn,$user,$pwd) or die "Error in connect to $dsn: $!\n"; $sth = $con->prepare($sql) or die "Error in prepare : $!"; $sth->execute() or die "Error in execute : $!"; print "Relname\t\tRelacl\n"; while ( @row = $sth->fetchrow_array() ) { print $row[0] . "\t" . $row[1] . "\n"; } $sth->finish(); $con->disconnect();