public inbox for [email protected]  
help / color / mirror / Atom feed
From: Mark Dilger <[email protected]>
To: Pavel Borisov <[email protected]>
Cc: Anastasia Lubennikova <[email protected]>
Cc: Postgres hackers <[email protected]>
Cc: Peter Geoghegan <[email protected]>
Subject: Re: [PATCH] Improve amcheck to also check UNIQUE constraint in btree index.
Date: Mon, 1 Mar 2021 11:21:59 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CALT9ZEFYsYPms0SPp4ZxpFCOBQbgE+iopoVKzU8Pni8Y6+RKtQ@mail.gmail.com>
References: <CALT9ZEHRn5xAM5boga0qnrCmPV52bScEK2QnQ1HmUZDD301JEg@mail.gmail.com>
	<[email protected]>
	<CALT9ZEFYsYPms0SPp4ZxpFCOBQbgE+iopoVKzU8Pni8Y6+RKtQ@mail.gmail.com>



> On Feb 9, 2021, at 10:43 AM, Pavel Borisov <[email protected]> wrote:
> 
> вт, 9 февр. 2021 г. в 01:46, Mark Dilger <[email protected]>:
> 
> 
> > On Feb 8, 2021, at 2:46 AM, Pavel Borisov <[email protected]> wrote:
> > 
> > 0002 - is a temporary hack for testing. It will allow inserting duplicates in a table even if an index with the exact name "idx" has a unique constraint (generally it is prohibited to insert). Then a new amcheck will tell us about these duplicates. It's pity but testing can not be done automatically, as it needs a core recompile. For testing I'd recommend a protocol similar to the following:
> > 
> > - Apply patch 0002
> > - Set autovaccum = off in postgresql.conf
> 
> Thanks Pavel and Anastasia for working on this!
> 
> Updating pg_catalog directly is ugly, but the following seems a simpler way to set up a regression test than having to recompile.  What do you think?
> 
> Very nice idea, thanks!
> I've made a regression test based on it. PFA v.2 of a patch. Now it doesn't need anything external for testing.

If bt_index_check() and bt_index_parent_check() are to have this functionality, shouldn't there be an option controlling it much as the option (heapallindexed boolean) controls checking whether all entries in the heap are indexed in the btree?  It seems inconsistent to have an option to avoid checking the heap for that, but not for this.  Alternately, this might even be better coded as its own function, named something like bt_unique_index_check() perhaps.  I hope Peter might advise?

The regression test you provided is not portable.  I am getting lots of errors due to differing output of the form "page lsn=0/4DAD7E0".  You might turn this into a TAP test and use a regular expression to check the output.

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company








view thread (32+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] Improve amcheck to also check UNIQUE constraint in btree index.
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox