Re: simplifying foreign key/RI checks - Mailing list pgsql-hackers

From Amit Langote
Subject Re: simplifying foreign key/RI checks
Date
Msg-id CA+HiwqHmZ9RpxVNg9M7ktzF1i6unGVpeBLqortEjW6NVtm+GvQ@mail.gmail.com
Whole thread Raw
In response to Re: simplifying foreign key/RI checks  (Zhihong Yu <zyu@yugabyte.com>)
List pgsql-hackers
On Tue, Jan 19, 2021 at 12:00 PM Zhihong Yu <zyu@yugabyte.com> wrote:
> +               if (mapped_partkey_attnums[i] == pk_attnums[j])
> +               {
> +                   partkey_vals[i] = pk_vals[j];
> +                   partkey_isnull[i] = pk_nulls[j] == 'n' ? true : false;
> +                   i++;
> +                   break;
>
> The way counter (i) is incremented is out of my expectation.
> In the rare case, where some i doesn't have corresponding pk_attnums[j], wouldn't there be a dead loop ?
>
> I think the goal of adding the assertion should be not loop infinitely even if the invariant is not satisfied.
>
> I guess a counter other than i would be better for this purpose.

I have done that in v3.  Thanks.

-- 
Amit Langote
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: simplifying foreign key/RI checks
Next
From: yuzuko
Date:
Subject: Re: Release SPI plans for referential integrity with DISCARD ALL