Re: Patch to check whether we are in TX when to lo_* - Mailing list pgsql-patches

From Denis Perchine
Subject Re: Patch to check whether we are in TX when to lo_*
Date
Msg-id 00110323224400.00544@dyp.perchine.com
Whole thread Raw
In response to Re: Patch to check whether we are in TX when to lo_*  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
> > here is the patch attached which do check in each BLOB operation, if
> > we are in transaction, and raise an error otherwise. This will prevent
> > such mistakes.
>
> Hmm.  I'm not sure if this is a good idea, or just overprotective
> nannyism.  Comments anyone?
>
> As is, it's certainly undesirable because it will break backend
> lo_export and lo_import, neither of which need to be in an xact block.
> Perhaps that could be worked around somehow, but is it worth the
> trouble?

Hmmm... Actually you always should do BLOB operations in TX. I added this
check because some time ago I spent quite long time when I tried to figure
out what was wrong with my small test code. It successfully opens BLOB, but
then it complains about unknown fd. The reason was that I did this outside of
TX. After each command TX was automatically commited, and all fd's was
cleaned up. It is not so easy to detect such problem if you do not know the
code...

--
Sincerely Yours,
Denis Perchine

----------------------------------
E-Mail: dyp@perchine.com
HomePage: http://www.perchine.com/dyp/
FidoNet: 2:5000/120.5
----------------------------------

pgsql-patches by date:

Previous
From: Stephan Szabo
Date:
Subject: Inherited column patches
Next
From: Bruce Momjian
Date:
Subject: Re: Inherited column patches