Browse files

Set lo_compat_privileges to ON at database creation.

This copes with the lack of a privilege to lo_unlink() a large object
that a user doesn't own.
  • Loading branch information...
1 parent d83b413 commit 9e3924cc91f6c52657e4fe05e473a2400fddcf4c @manitou-mail committed Sep 18, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 script/manitou-mgr
9 script/manitou-mgr
@@ -261,6 +261,12 @@ sub create_database {
$dbh1->do("CREATE DATABASE $dbname OWNER $dbuser") or die;
print "Database $dbname created.\n" unless ($opt_quiet);
+ if ($dbh1->{pg_server_version}/10000 >= 9) {
+ # Since Pg 9.0, each large object has it own ACL, except that lo_unlink() is ever
+ # only permitted to the object's owner. That's too restrictive for us; it would
+ # mean that only the db owner can delete messages, so we stick to pre-9.0 mode.
+ $dbh1->do("ALTER DATABASE $dbname SET lo_compat_privileges TO on") or die $dbh1->errstr;
+ }
# Reconnect to the new database as a superuser
@@ -377,9 +383,6 @@ sub clear_word_index {
# Reindex a partition (inverted_word_index.part_no) in a forked process.
# Several reindex jobs can run concurrently in different processes, each
# with its own db connection.
-# Due to Perl's inefficiency in reusing the memory from our freed bitvectors,
-# we also manage our memory limit by terminating and respawning a
-# new child process when it has buffered enough word vectors.
sub child_reindex {
my ($cnx_string, $opt)=@_;
my $dbh = DBI->connect($cnx_string) or die "Can't connect: $DBI::errstr";

0 comments on commit 9e3924c

Please sign in to comment.