Re: Getting ERROR with FOR UPDATE/SHARE for partitioned table.

From: amul sul <sulamul(at)gmail(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Getting ERROR with FOR UPDATE/SHARE for partitioned table.
Date: 2020-05-28 11:30:40
Message-ID: CAAJ_b97QWnZ65TQTr3oESORkKjfiGY_JY4+ctGuqZq0yafja1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 28, 2020 at 3:06 PM Amit Langote <amitlangote09(at)gmail(dot)com>
wrote:

> On Thu, May 28, 2020 at 1:36 PM amul sul <sulamul(at)gmail(dot)com> wrote:
> > On Wed, May 27, 2020 at 12:53 PM Amit Langote <amitlangote09(at)gmail(dot)com>
> wrote:
> >> Actually, if you declare the cursor without FOR SHARE/UPDATE, the case
> >> would fail even with traditional inheritance:
> >>
> >> drop table if exists p cascade;
> >> create table p (a int);
> >> create table c (check (a = 2)) inherits (p);
> >> insert into p values (1);
> >> insert into c values (2);
> >> begin;
> >> declare c cursor for select * from p where a = 1;
> >> fetch c;
> >> update p set a = a where current of c;
> >> ERROR: cursor "c" is not a simply updatable scan of table "c"
> >> ROLLBACK
> >>
> >
> > I am not sure I understood the point, you'll see the same error with
> declarative
> > partitioning as well.
>
> My point is that if a table is not present in the cursor's plan, there
> is no way for CURRENT OF to access it. Giving an error in that case
> seems justified.
>
> OTOH, when the CURRENT OF implementation has RowMarks to look at, it
> avoids the error for traditional inheritance children due their
> inactive RowMarks being present in the cursor's PlannedStmt. I think
> that's only by accident though.
>

Yeah, make sense, thank you.

Regards,
Amul

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Martín Marqués 2020-05-28 11:42:59 Read access for pg_monitor to pg_replication_origin_status view
Previous Message Thomas Munro 2020-05-28 11:12:29 Re: WIP: WAL prefetch (another approach)