Re: second DML operation fails with updatable cursor
От
Heikki Linnakangas
Тема
Re: second DML operation fails with updatable cursor
Дата
Msg-id
471F69FE.5000500@enterprisedb.com
Ответ на
Список
Дерево обсуждения
second DML operation fails with updatable cursor "Dharmendra Goyal" <dharmendra.goyal@gmail.com>
Re: second DML operation fails with updatable cursor Tom Lane <tgl@sss.pgh.pa.us>
Re: second DML operation fails with updatable cursor Heikki Linnakangas <heikki@enterprisedb.com>
Re: second DML operation fails with updatable cursor Simon Riggs <simon@2ndquadrant.com>
Re: second DML operation fails with updatable cursor Tom Lane <tgl@sss.pgh.pa.us>
Re: second DML operation fails with updatable cursor Heikki Linnakangas <heikki@enterprisedb.com>
Re: second DML operation fails with updatable cursor Simon Riggs <simon@2ndquadrant.com>
Re: second DML operation fails with updatable cursor Tom Lane <tgl@sss.pgh.pa.us>
Re: second DML operation fails with updatable cursor Heikki Linnakangas <heikki@enterprisedb.com>
Re: second DML operation fails with updatable cursor Tom Lane <tgl@sss.pgh.pa.us>
Re: second DML operation fails with updatable cursor Heikki Linnakangas <heikki@enterprisedb.com>
Re: second DML operation fails with updatable cursor Tom Lane <tgl@sss.pgh.pa.us>
Re: second DML operation fails with updatable cursor Heikki Linnakangas <heikki@enterprisedb.com>
Re: second DML operation fails with updatable cursor Tom Lane <tgl@sss.pgh.pa.us>
Re: second DML operation fails with updatable cursor Heikki Linnakangas <heikki@enterprisedb.com>
Re: second DML operation fails with updatable cursor Simon Riggs <simon@2ndquadrant.com>
Re: second DML operation fails with updatable cursor Tom Lane <tgl@sss.pgh.pa.us>
Re: second DML operation fails with updatable
cursor Bruce Momjian <bruce@momjian.us>
Re: second DML operation fails with updatable cursor Tom Lane <tgl@sss.pgh.pa.us>
Re: second DML operation fails with updatable cursor Heikki Linnakangas <heikki@enterprisedb.com>
Tom Lane wrote: > Heikki Linnakangas writes: >> That would solve the problem with two updates of the same row, but not this: >> UPDATE .. WHERE CURRENT OF... >> FETCH RELATIVE 0 > >> At the moment, that returns the next row, not the one that was updated. >> Same problem with FETCH NEXT + FETCH PRIOR after the UPDATE. > > Hmm, what I'm seeing is that it returns the original (unmodified) row; > is that what you meant to say? No, that's not what I meant. Here's what I get: postgres=# CREATE TABLE foo (id integer); CREATE TABLE postgres=# INSERT INTO foo SELECT a from generate_series(1,100) a; INSERT 0 100 postgres=# BEGIN; BEGIN postgres=# DECLARE c CURSOR FOR SELECT id FROM foo FOR UPDATE; DECLARE CURSOR postgres=# FETCH 2 FROM c;id ---- 1 2 (2 rows) postgres=# UPDATE foo set ID=20 WHERE CURRENT OF c; UPDATE 1 postgres=# FETCH RELATIVE 0 FROM c;id ---- 3 (1 row) I was expecting to get 20. I do get the original unmodified tuple (2) if I leave out the FOR UPDATE. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления