pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Teach contrib/amcheck to check the unique constraint violation
Date: Fri, 27 Oct 2023 21:21:50 +0000
Message-ID: <E1qwUH8-002fDJ-Eq@gemulon.postgresql.org> (raw)

Teach contrib/amcheck to check the unique constraint violation

Add the 'checkunique' argument to bt_index_check() and bt_index_parent_check().
When the flag is specified the procedures will check the unique constraint
violation for unique indexes.  Only one heap entry for all equal keys in
the index should be visible (including posting list entries).  Report an error
otherwise.

pg_amcheck called with the --checkunique option will do the same check for all
the indexes it checks.

Author: Anastasia Lubennikova <lubennikovaav@gmail.com>
Author: Pavel Borisov <pashkin.elfe@gmail.com>
Author: Maxim Orlov <orlovmg@gmail.com>
Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com>
Reviewed-by: Zhihong Yu <zyu@yugabyte.com>
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>
Discussion: https://postgr.es/m/CALT9ZEHRn5xAM5boga0qnrCmPV52bScEK2QnQ1HmUZDD301JEg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5ae2087202af9fd804c8b8d76954bdd8bdf31e51

Modified Files
--------------
contrib/amcheck/Makefile                      |   2 +-
contrib/amcheck/amcheck--1.3--1.4.sql         |  29 +++
contrib/amcheck/amcheck.control               |   2 +-
contrib/amcheck/expected/check_btree.out      |  42 ++++
contrib/amcheck/meson.build                   |   2 +
contrib/amcheck/sql/check_btree.sql           |  14 ++
contrib/amcheck/t/004_verify_nbtree_unique.pl | 244 +++++++++++++++++++
contrib/amcheck/verify_nbtree.c               | 330 ++++++++++++++++++++++++--
doc/src/sgml/amcheck.sgml                     |  14 +-
doc/src/sgml/ref/pg_amcheck.sgml              |  11 +
src/bin/pg_amcheck/pg_amcheck.c               |  48 +++-
src/bin/pg_amcheck/t/003_check.pl             |  50 ++++
src/bin/pg_amcheck/t/005_opclass_damage.pl    |  65 +++++
13 files changed, 830 insertions(+), 23 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1qwUH8-002fDJ-Eq@gemulon.postgresql.org>
Permalink:  ../E1qwUH8-002fDJ-Eq@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qwUH8-002fDJ-Eq@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Teach contrib/amcheck to check the unique constraint violation
  In-Reply-To: <E1qwUH8-002fDJ-Eq@gemulon.postgresql.org>

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

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