Re: Getting ERROR with FOR UPDATE/SHARE for partitioned table. - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Getting ERROR with FOR UPDATE/SHARE for partitioned table.
Date
Msg-id CAExHW5uqL-em7EeBk6=n7WO=KYzPZz=K4-J2xO41WNx836zKVg@mail.gmail.com
Whole thread Raw
In response to Re: Getting ERROR with FOR UPDATE/SHARE for partitioned table.  (Amit Langote <amitlangote09@gmail.com>)
Responses Re: Getting ERROR with FOR UPDATE/SHARE for partitioned table.
List pgsql-hackers
On Wed, May 27, 2020 at 6:51 PM Amit Langote <amitlangote09@gmail.com> wrote:

>
> So in Rajkumar's example, the cursor is declared as:
>
> CURSOR IS SELECT * FROM tbl WHERE c1< 5 FOR UPDATE;
>
> and the WHERE CURRENT OF query is this:
>
>  UPDATE tbl SET c2='aa' WHERE CURRENT OF cur;

Thanks for the clarification. So it looks like we expand UPDATE on
partitioned table to UPDATE on each partition (inheritance_planner for
DML) and then execute each of those. If CURRENT OF were to save the
table oid or something we could run the UPDATE only on that partition.
I am possibly shooting in dark, but this puzzles me. And it looks like
we can cause wrong rows to be updated in non-partition inheritance
where the ctids match?

-- 
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: password_encryption default
Next
From: "David G. Johnston"
Date:
Subject: Re: Explain Analyze (Rollback off) Suggestion