Re: Patch to check whether we are in TX when to lo_*

From: Denis Perchine <dyp(at)perchine(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch to check whether we are in TX when to lo_*
Date: 2000-11-03 17:22:44
Message-ID: 00110323224400.00544@dyp.perchine.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)perchine(dot)com
HomePage: http://www.perchine.com/dyp/
FidoNet: 2:5000/120.5
----------------------------------

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2000-11-03 17:33:05 Re: Patch to check whether we are in TX when to lo_*
Previous Message Denis Perchine 2000-11-03 15:59:47 Patch to check whether we are in TX when to lo_*