On Fri, May 13, 2005 at 02:39:25AM -0000, Greg Sabino Mullane wrote:

> I'm having some problems with lo_open inside of DBD::Pg (which
> uses libpq) and need help in debugging the problem. The problem
> is that a call to lo_open works perfectly, *unless* it is the
> first thing that this connection to the database has done, in
> which case it returns a -1 (which comes back to perl as undef).
> To be more specific, I need to issue a "SELECT 123;" (or anything
> else via PQexec) before the call will succeeed. All the parameters
> to lo_open look normal and identical whether PQexec has been called
> or not, and lo_creat always works just fine. It has to be PQexec*,
> a prepare alone will not do the trick.

The problem is that LO descriptors are only valid for the duration of
the transaction.  So your "select 123" opens a transaction, and
autocommit = 0 makes it not close until after the function is called.
If you don't send the query first, both function calls happen in
different transactions.

I think you should make the func() method open a transaction, just like
a query does.

-- 
Alvaro Herrera (<alvherre[a]surnet.cl>)
La web junta la gente porque no importa que clase de mutante sexual seas,
tienes millones de posibles parejas. Pon "buscar gente que tengan sexo con
ciervos incendiándose", y el computador dirá "especifique el tipo de ciervo"
(Jason Alexander)

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to