Re: [HACKERS] libpq questuion

Поиск
Список
Период
Сортировка
От jwieck@debis.com (Jan Wieck)
Тема Re: [HACKERS] libpq questuion
Дата
Msg-id m109rxh-000EBRC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответ на libpq questuion  (Dmitry Samersoff <dms@wplus.net>)
Ответы RE: [HACKERS] libpq questuion  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Список pgsql-hackers
Dmitry Samersoff wrote:

>
> While update table whithin fetch forward loop
> cause infinite fetching of updated touple?
>
> (code fragment below cause infinite
> displayng record with oid 20864)
>
>
> ----------------------------------------------------------------------------
> PQexec(_conn, "BEGIN");
> PQexec(_conn, "DECLARE curr1 CURSOR FOR select oid, name from domains;");
>
> while(1)
> {
>   _res = PQexec(_conn, "FETCH FORWARD 1 IN curr1");
>    if(  PQresultStatus(_res) != PGRES_TUPLES_OK ) break;
>
>    PQexec(_conn, "update domains set type = 3 where oid = 20864" );
>    printf("oid: %s name: %s\n", PQgetvalue(_res,0,0),PQgetvalue(_res,0,1));
> }
> ---------------------------------------------------------------------------

    Which Postgres version?

    I  guess  it  is  a side effect from the visibility of tuples
    (records) in conjunction with portals (cursors).

    The reason must be that the the UPDATE inside the loop  add's
    new  tuples  to  the  table  at  it's  end.  It also issues a
    CommandCounterIncrement(), so the new tuples get  visible  to
    the already running scan for the portal.

    I planned to get my hands onto the visibility code in tqual.c
    after v6.5 to prepare the system  for  deferred  queries.   I
    have  some  things  about  it  in  mind, but must discuss the
    details with Vadim  before  I  start  implementing  it.  They
    interfere with MVCC.

    Should I go for it before v6.5?


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #

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

Предыдущее
От: Dan Gowin
Дата:
Сообщение: RE: Commercial support, was Re: [HACKERS] v6.4.3 ?
Следующее
От: Nick Bastin
Дата:
Сообщение: Re: Commercial support, was Re: [HACKERS] v6.4.3 ?