pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix ON CONFLICT DO NOTHING/UPDATE for temporal indexes
Date: Fri, 10 May 2024 13:11:26 +0000
Message-ID: <E1s5Q21-000KWK-GE@gemulon.postgresql.org> (raw)

Fix ON CONFLICT DO NOTHING/UPDATE for temporal indexes

A PRIMARY KEY or UNIQUE constraint with WITHOUT OVERLAPS will be a
GiST index, not a B-Tree, but it will still have indisunique set.  The
code for ON CONFLICT fails if it sees a non-btree index that has
indisunique.  This commit fixes that and adds some tests.  But now
that we can't just test indisunique, we also need some extra checks to
prevent DO UPDATE from running against a WITHOUT OVERLAPS constraint
(because the conflict could happen against more than one row, and we'd
only update one).

Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://www.postgresql.org/message-id/1426589a-83cb-4a89-bf40-713970c07e63@illuminatedcomputing.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/144c2ce0cc75ff99c66749b0ca5235d037df7c09

Modified Files
--------------
src/backend/executor/execIndexing.c            |   2 +-
src/backend/optimizer/util/plancat.c           |   9 +-
src/test/regress/expected/without_overlaps.out | 176 +++++++++++++++++++++++++
src/test/regress/sql/without_overlaps.sql      | 113 ++++++++++++++++
4 files changed, 298 insertions(+), 2 deletions(-)



Message-ID: <E1s5Q21-000KWK-GE@gemulon.postgresql.org>
Permalink:  ../E1s5Q21-000KWK-GE@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1s5Q21-000KWK-GE@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: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix ON CONFLICT DO NOTHING/UPDATE for temporal indexes
  In-Reply-To: <E1s5Q21-000KWK-GE@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