Re: a misbehavior of partition row movement (?)

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Zhihong Yu <zyu(at)yugabyte(dot)com>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, Arne Roland <A(dot)Roland(at)index(dot)de>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Subject: Re: a misbehavior of partition row movement (?)
Date: 2022-03-19 20:13:43
Message-ID: 202203192013.7ztcjeesrwnd@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2022-Mar-18, Zhihong Yu wrote:

> +#define AFTER_TRIGGER_OFFSET 0x07FFFFFF /* must be low-order
> bits */
> +#define AFTER_TRIGGER_DONE 0x80000000
> +#define AFTER_TRIGGER_IN_PROGRESS 0x40000000
> Is it better if the order of AFTER_TRIGGER_DONE
> and AFTER_TRIGGER_IN_PROGRESS is swapped (for the ordinal values to be
> sequential) ?

They *are* sequential -- See

> +#define AFTER_TRIGGER_CP_UPDATE 0x08000000
> It would be better to add a comment for this constant, explaining what CP
> means (cross partition).


> + if (!partRel->rd_rel->relispartition)
> + elog(ERROR, "cannot find ancestors of a non-partition result
> relation");
> It would be better to include the relation name in the error message.

I don't think it matters. We don't really expect to hit this.

> + /* Ignore the root ancestor, because ...?? */
> Please fill out the remainder of the comment.

I actually would like to know what's the rationale for this myself.

> + if (!trig->tgisclone &&
> + RI_FKey_trigger_type(trig->tgfoid) == RI_TRIGGER_PK)
> + {
> + has_noncloned_fkey = true;
> The variable says fkey, but the constant is not RI_TRIGGER_FK. Maybe add a
> comment explaining why.

Well, the constant is about the trigger *function*, not about any
constraint. This code is testing "is this a noncloned trigger, and does
that trigger use an FK-related function?" If you have a favorite
comment to include, I'm all ears.

Álvaro Herrera 39°49'30"S 73°17'W —
"It takes less than 2 seconds to get to 78% complete; that's a good sign.
A few seconds later it's at 90%, but it seems to have stuck there. Did
somebody make percentages logarithmic while I wasn't looking?"

Attachment Content-Type Size
v16-0001-Enforce-foreign-key-correctly-during-cross-parti.patch text/x-diff 64.6 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-03-19 20:35:05 Re: Commitfest manager for 2022-03
Previous Message Andres Freund 2022-03-19 18:51:28 Re: Regression tests failures on Windows Server 2019 - on master at commit # d816f366b