RE: PL/pgSQL bug?

Поиск
Список
Период
Сортировка
От Hiroshi Inoue
Тема RE: PL/pgSQL bug?
Дата
Msg-id EKEJJICOHDIEMGPNIFIJAENPFBAA.Inoue@tpf.co.jp
обсуждение исходный текст
Ответ на RE: PL/pgSQL bug?  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Ответы Re: PL/pgSQL bug?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
 Tatsuo Ishii wrote:
>
> > > One way to make the results equivalent is to compute a new
QuerySnapshot
> > > for each SPI query.  Quite aside from the cost of doing so, I do not
> > > think it makes sense, considering that the previous QuerySnapshot must
> > > be restored when we return from the function.  Do we really want
> > > functions to see transaction status different from what's seen outside
> > > the function call?
> >
> > Yes I do.
>
> Me too. Current behavior of procedural languages seem hard to
> understand for users.
>

Yes it's a siginificant point. I've referred to the
impropriety to use a unique snapshot thoughout a
function call when this kind of bug(?) was reported.
Who could take care of it in writing PL/pgSQL ?

> BTW, why must we restore the previous QuerySnapshot?

For example, in the case such as select .., some_func(item1), .. from a_table;
SELECT always uses the same snapshot for all its
internal fetch operations, so it seems reasonable
for each some_func() to be called in the same snapshot.
It's possible for a function to use a unique snapshot
if there are only SELECT statements in the function
but it's impossible if there are UPDATE/DELETE or
SELECT .. FOR UPDATE statements etc.. We should be
careful to handle such functions which have side
effects. IMHO we shouldn't call such functions or
shouldn't expect consistent results with the use
of such funtions. OTOH select some_func(..);
is a procedure call not a function call in reality.
There seems to be no necessity to restore the previous
QuerySnapshot when calling procedures and we could
call any function as a procedure.

regards,
Hiroshi Inoue



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ian Lance Taylor
Дата:
Сообщение: Re: Re: [PATCHES] Select parser at runtime
Следующее
От: Gavin Sherry
Дата:
Сообщение: Re: example program bug?