Re: [PATCH] Keeps tracking the uniqueness with UniqueKey

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: Floris Van Nee <florisvannee(at)optiver(dot)com>
Cc: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, "rushabh(dot)lathia(at)gmail(dot)com" <rushabh(dot)lathia(at)gmail(dot)com>
Subject: Re: [PATCH] Keeps tracking the uniqueness with UniqueKey
Date: 2020-08-03 22:59:50
Message-ID: CAKU4AWqvWkyi0y-pdOPvoC9XvO7x-Atk1g5KBmPeFi6Bhey36g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Floris:

On Thu, Jul 23, 2020 at 3:22 AM Floris Van Nee <florisvannee(at)optiver(dot)com>
wrote:

> Hi Andy,
>
>
>
> A small thing I found:
>
>
>
> +static List *
>
> +get_exprs_from_uniqueindex(IndexOptInfo *unique_index,
>
> +
> List *const_exprs,
>
> +
> List *const_expr_opfamilies,
>
> +
> Bitmapset *used_varattrs,
>
> +
> bool *useful,
>
> +
> bool *multi_nullvals)
>
> …
>
> + indexpr_item = list_head(unique_index->indexprs);
>
> + for(c = 0; c < unique_index->ncolumns; c++)
>
> + {
>
>
>
> I believe the for loop must be over unique_index->nkeycolumns, rather than
> columns. It shouldn’t include the extra non-key columns. This can currently
> lead to invalid memory accesses as well a few lines later when it does an
> array access of unique_index->opfamily[c] – this array only has nkeycolumns
> entries.
>

You are correct, I would include this in the next version patch, Thank you
for this checking!

--
Andy Fan
Best Regards

>
>
>
>
> *From:* Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
> *Sent:* Sunday 19 July 2020 5:03 AM
> *To:* Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
> *Cc:* David Rowley <dgrowleyml(at)gmail(dot)com>; PostgreSQL Hackers <
> pgsql-hackers(at)lists(dot)postgresql(dot)org>; Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>;
> Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>; rushabh(dot)lathia(at)gmail(dot)com
> *Subject:* Re: [PATCH] Keeps tracking the uniqueness with UniqueKey
> [External]
>
>
>
> Fixed a test case in v10.
>
>
>
> --
>
> Best Regards
>
> Andy Fan
>

--
Best Regards
Andy Fan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-08-03 23:48:54 ALTER TABLE .. DETACH PARTITION CONCURRENTLY
Previous Message Peter Geoghegan 2020-08-03 22:55:36 Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM