Re: storing intermediate results in recursive plpgsql functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vince Vielhaber <vev(at)michvhf(dot)com>
Cc: Fran Fabrizio <ffabrizio(at)mmrd(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: storing intermediate results in recursive plpgsql functions
Date: 2002-03-05 17:37:18
Message-ID: 16694.1015349838@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Vince Vielhaber <vev(at)michvhf(dot)com> writes:
> So if the function is executed in a transaction and the transaction
> ends when the function does, doesn't that mean the lock is released
> when the function ends?

But the transaction *doesn't* end when the function does.

The function must have been called from some SQL query (eg, a SELECT)
and there is an explicit or implicit transaction wrapped around every
query issued by an application. The earliest the lock can possibly be
released is when the current application-given query ends. If the query
is inside an explicit BEGIN/COMMIT block then the lock will be held till
you COMMIT or ROLLBACK.

Feel free to propose better wording for that part of the plpgsql docs...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message W. McCloud 2002-03-05 17:38:35 Re: Which administration software to use
Previous Message Jean-Michel POURE 2002-03-05 17:35:39 Re: database problem..