Hi Fujita-san, I am having some minor problems running this repro
On Thu, Jan 15, 2015 at 12:45 PM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp > wrote: > Here is an example using postgres_fdw. > > [Terminal 1] > postgres=# create table t (a int, b int); > CREATE TABLE > postgres=# insert into t values (1, 1); > INSERT 0 1 > postgres=# begin; > BEGIN > postgres=# update t set b = b * 2; > UPDATE 1 > > [Terminal 2] > postgres=# create foreign table ft (a int) server loopback options > (table_name 'lbt'); > There isn't any table "lbt" mentioned here. Do you mean "t" here? > CREATE FOREIGN TABLE > postgres=# insert into ft values (1); > INSERT 0 1 > postgres=# select tableoid, ctid, * from ft; > tableoid | ctid | a > ----------+-------+--- > 25092 | (0,1) | 1 > (1 row) > Shouldn't we see two values here one inserted in 't' and one in "ft" > > postgres=# select ft.tableoid, ft.ctid, ft.* from t, ft where t.a = ft.a > for update; > > [Terminal 1] > postgres=# commit; > COMMIT > > [Terminal 2] > postgres=# select ft.tableoid, ft.ctid, ft.* from t, ft where t.a = ft.a > for update; > tableoid | ctid | a > ----------+----------------+--- > 0 | (4294967295,0) | 1 > (1 row) > > Instead of this result, I got following error ERROR: could not serialize access due to concurrent update CONTEXT: Remote SQL command: SELECT a, ctid FROM public.t FOR UPDATE Am I missing something while reproducing the problem? > Note that tableoid and ctid have been changed! > > I think the reason for that is because EvalPlanQualFetchRowMarks doesn't > properly set tableoid and ctid for foreign tables, IIUC. I think this > should be fixed. Please find attached a patch. The patch slightly > relates to [1], so if it is reasonable, I'll update [1] on top of this. > > [1] https://commitfest.postgresql.org/action/patch_view?id=1386 > > Best regards, > Etsuro Fujita > > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers > > -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company