Re: An out-of-date comment in nodeIndexonlyscan.c

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Ashwin Agrawal <aagrawal(at)pivotal(dot)io>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Kevin Grittner <kgrittn(at)gmail(dot)com>
Subject: Re: An out-of-date comment in nodeIndexonlyscan.c
Date: 2021-06-14 02:28:50
Message-ID: CAApHDvreE=y8p5nGEF4ur-0Yk_uXm7Nquk49JvAA+6ifce_exg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 14 Jun 2021 at 10:03, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
>
> On Mon, Jun 14, 2021 at 12:54 AM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> > I think a more optimal and nicer way of doing that would be setting
> > bits in a Bitmapset then checking bms_num_members is equal to
> > n_scan_keys.
>
> Shouldn't it be compared with indnkeyatts? Yes, much nicer, thanks!

Oh yeah, I did mean that. Thanks for the correction.

Have you also thought about deferrable unique / primary key constraints?

It's possible to the uniqueness temporarily violated during a
transaction when the unique constraint is deferred,

For example:
create table t (id int primary key deferrable initially deferred);
begin;
insert into t values(1),(1);
select * from t;
id
----
1
1
(2 rows)

I think you'd just need to add a check to ensure that indimmediate is
true around where you're checking the indisunique flag.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2021-06-14 02:29:02 Re: unnesting multirange data types
Previous Message Yugo NAGATA 2021-06-14 02:20:37 Re: Avoid stuck of pbgench due to skipped transactions