Re: a misbehavior of partition row movement (?)

From: Rahila Syed <rahilasyed90(at)gmail(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Arne Roland <A(dot)Roland(at)index(dot)de>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: a misbehavior of partition row movement (?)
Date: 2021-02-24 06:06:50
Message-ID: CAH2L28vM0p=tkmMNnb+HtHMfxtAtVmNXWfR7Eu4d2aJAy8YTtA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Amit,

Sorry for the late reply.

I assume these are comments for the v3-0001 & v3-0002 patches...
>
> Yes, those were comments for patches on master.

> > The partition-key-update-1.spec test fails with the following error
> message appearing in the diffs.
> >
> > step s1u3pc: UPDATE foo_range_parted SET a=11 WHERE a=7;
> > +ERROR: cannot move row being updated to another partition
>
> ...whereas, this error happens with the patch I posted in my last
> email (prevent-row-movement-on-pk-table.patch) that is not meant to be
> considered for HEAD, but for back-branches (if at all). I also see
> that cfbot got triggered by it and shows the same failure. I am not
> going to try to take care of these failures unless we want to do
> something in the back-branches.
>
> To be clear, patches for HEAD do pass make check-world.
>
> OK.

> > I think the documentation update is missing from the patches.
>
> Hmm, I don't think we document the behavior that is improved by the v3
> patches as a limitation of any existing feature, neither of foreign
> keys referencing partitioned tables nor of the update row movement
> feature. So maybe there's nothing in the existing documentation that
> is to be updated.
>
> However, the patch does add a new error message for a case that the
> patch doesn't handle, so maybe we could document that as a limitation.
> Not sure if in the Notes section of the UPDATE reference page which
> has some notes on row movement or somewhere else. Do you have
> suggestions?
>
> You are right, I could not find any direct explanation of the impact of
row movement during
UPDATE on a referencing table in the PostgreSQL docs.

The two documents that come close are either:

1. https://www.postgresql.org/docs/13/trigger-definition.html .
The para starting with "If an UPDATE on a partitioned table causes a row to
move to another partition"
However, this does not describe the behaviour of internal triggers which
is the focus of this patch.

2. Another one like you mentioned,
https://www.postgresql.org/docs/11/sql-update.html
This has explanation for row movement behaviour for partitioned table but
does not explain
any impact of such behaviour on a referencing table.
I think it is worth adding some explanation in this document. Thus,
explaining
impact on referencing tables here, as it already describes behaviour of
UPDATE on a partitioned table.

Thank you.
Rahila Syed

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-02-24 06:19:00 Re: Asynchronous and "direct" IO support for PostgreSQL.
Previous Message wangsh.fnst@fujitsu.com 2021-02-24 05:53:13 RE: Refactor ECPGconnect and allow IPv6 connection