pradeep singh <lets_begin_with_me@yahoo.com> writes:
> CREATE OR REPLACE FUNCTION recalc_add_bitset()
> RETURNS trigger AS $$
> use DBI;
> my $dbname = 'database_name';
> my $dbh = DBI->connect("dbi:Pg:dbname='$dbname'",
> "postgres_user_id", "password", {AutoCommit => 0,
> RaiseError=>1});
That (using DBI in a trigger) is a really bad idea in most cases.
The DBI connection is a separate transaction that (a) can't see
the uncommitted results of your transaction and (b) can have lock
conflicts against your transaction. I suspect (b) explains the
hang, though the part of the problem you've shown us doesn't make
it clear exactly why there's a conflict.
plperl has a database access protocol, learn to use it.
regards, tom lane