Re: simplifying foreign key/RI checks

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: simplifying foreign key/RI checks
Date: 2021-12-21 08:56:06
Message-ID: CALNJ-vTfdzpQNAVaq=fvgnMbHOCGpRWuMjMCtFfi17kM2ERcSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 20, 2021 at 5:17 AM Amit Langote <amitlangote09(at)gmail(dot)com>
wrote:

> On Mon, Dec 20, 2021 at 6:19 PM Zhihong Yu <zyu(at)yugabyte(dot)com> wrote:
> > On Sun, Dec 19, 2021 at 10:20 PM Amit Langote <amitlangote09(at)gmail(dot)com>
> wrote:
> >>
> >> On Mon, Dec 20, 2021 at 2:00 PM Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
> wrote:
> >> > Sorry for the delay. This patch no longer applies, it has some
> conflict with d6f96ed94e73052f99a2e545ed17a8b2fdc1fb8a
> >>
> >> Thanks Corey for the heads up. Rebased with some cosmetic adjustments.
> >>
> > Hi,
> >
> > + Assert(partidx < 0 || partidx < partdesc->nparts);
> > + partoid = partdesc->oids[partidx];
> >
> > If partidx < 0, do we still need to fill out partoid and is_leaf ? It
> seems we can return early based on (should call table_close(rel) first):
> >
> > + /* No partition found. */
> > + if (partidx < 0)
> > + return NULL;
>
> Good catch, thanks. Patch updated.
>
> Hi,

+ int lockflags = 0;
+ TM_Result test;
+
+ lockflags = TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS;

The above assignment can be meged with the line where variable lockflags is
declared.

+ GetUserIdAndSecContext(&save_userid, &save_sec_context);

save_userid -> saved_userid
save_sec_context -> saved_sec_context

+ * the transaction-snapshot mode. If we didn't push one already, do

didn't push -> haven't pushed

For ri_PerformCheck():

+ bool source_is_pk = true;

It seems the value of source_is_pk doesn't change - the value true can be
plugged into ri_ExtractValues() calls directly.

Cheers

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2021-12-21 08:58:54 Re: row filtering for logical replication
Previous Message Kyotaro Horiguchi 2021-12-21 08:13:21 Re: In-placre persistance change of a relation