From: ivan <ivan>
Date: Fri, 25 Feb 2005 22:14:41 +0000 (+0000)
Subject: try to set the sequences right for modern Pg
X-Git-Tag: SQL_LEDGER_2_4_4~1^2~464
X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=76f5008e4d5f6f5016f1c136f740f1f4b9c0b29c;p=freeside.git

try to set the sequences right for modern Pg
---

diff --git a/bin/pg-readonly b/bin/pg-readonly
index 4f6d7c380..ad69fbde2 100644
--- a/bin/pg-readonly
+++ b/bin/pg-readonly
@@ -17,6 +17,8 @@ my $dbh = adminsuidsetup $user;
 foreach my $table ( dbdef->tables ) {
   $dbh->do("GRANT SELECT ON $table TO $rouser");
   $dbh->commit();
-  $dbh->do("GRANT SELECT ON ${table}_seq TO $rouser");
-  $dbh->commit();
+  if ( my $pkey = dbdef->table($table)->primary_key ) {
+    $dbh->do("GRANT SELECT ON ${table}_${pkey}_seq TO $rouser");
+    $dbh->commit();
+  }
 }