| From: | Amit Langote <amitlangote09(at)gmail(dot)com> | 
|---|---|
| To: | Zhihong Yu <zyu(at)yugabyte(dot)com> | 
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: simplifying foreign key/RI checks | 
| Date: | 2021-01-19 07:46:30 | 
| Message-ID: | CA+HiwqHmZ9RpxVNg9M7ktzF1i6unGVpeBLqortEjW6NVtm+GvQ@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On Tue, Jan 19, 2021 at 12:00 PM Zhihong Yu <zyu(at)yugabyte(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | yuzuko | 2021-01-19 07:57:27 | Re: Release SPI plans for referential integrity with DISCARD ALL | 
| Previous Message | Amit Langote | 2021-01-19 07:44:56 | Re: simplifying foreign key/RI checks |