Skip site navigation (1) Skip section navigation (2)

Re: help with error message from perl Pg

From: Geoffrey <esoteric(at)3times25(dot)net>
To: pgsql-general(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: help with error message from perl Pg
Date: 2006-06-20 14:20:19
Message-ID: 44980423.7080109@3times25.net (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-interfaces
Martijn van Oosterhout wrote:
> On Tue, Jun 20, 2006 at 09:33:13AM -0400, Geoffrey wrote:
>> We have an unusual problem with some perl code that is processing data 
>> via DBD facility.  Basically, the code consists of various subroutines 
>> that are identified in a hash.  The primary script then references the 
>> subroutines through a &$prog(...) syntax.  What appears to happen is 
>> that all subroutines will run just fine if they do not need to do any 
>> deletes or updates to the database.  Any subroutine that does a delete 
>> or update runs fine, but the subsequent routine fails with the following 
>> error:
>>
>> prgcaphlg: FATAL:  invalid frontend message type 78
> 
> Errors in the FE-BE protocol are usually caused by users trying to use
> the same connection from multiple threads simultaneously. libpq doesn't
> handle that and so ends up sending things out of order.
> 
> Are you using threads?

Not intentionally.  I'm assuming I would have to specify a threaded 
process explicitly.

> Also, the database connection, how is the handle passed around? Youre
> not closing it accedently somewhere?

We considered that and have verified that we are not closing it.  But, 
the question came up, should we be passing it by reference or value?  We 
are doing the following:

my $conn = Pg::connectdb ("dbname=$db port=$port");
.
.
my $retVal = &$prog($conn, @args);

Question is, should we be doing:

my $retVal = &$prog(\$conn, @args);


FYI, there's no expectation of changing $conn in anyway within the sub 
routines.

-- 
Until later, Geoffrey

Any society that would give up a little liberty to gain a little
security will deserve neither and lose both.  - Benjamin Franklin

In response to

Responses

pgsql-interfaces by date

Next:From: A.M.Date: 2006-06-20 14:43:32
Subject: Re: help with error message from perl Pg
Previous:From: Martijn van OosterhoutDate: 2006-06-20 13:59:45
Subject: Re: help with error message from perl Pg

pgsql-general by date

Next:From: A.M.Date: 2006-06-20 14:43:32
Subject: Re: help with error message from perl Pg
Previous:From: WesDate: 2006-06-20 14:18:08
Subject: Re: Adding foreign key constraints without integrity

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group