pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: hmoustaid.mships@gmail.com
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: constraint_exclusion not working correctly
Date: Thu, 15 Aug 2024 22:26:19 -0400
Message-ID: <661806.1723775179@sss.pgh.pa.us> (raw)
In-Reply-To: <172364933910.395942.11462602571152584372@wrigleys.postgresql.org>
References: <172364933910.395942.11462602571152584372@wrigleys.postgresql.org>

PG Doc comments form <noreply@postgresql.org> writes:
> I have noted that, in order for constraint exclusion to work correctly when
> partitioning using inheritance, we must use simple comparisons in check
> constraints (e.g., =, >=, <=, BETWEEN, etc.). If conditions are combined
> using AND or OR, unnecessary partitions may be scanned.

> Therefore, the example in this PostgreSQL documentation will not work
> properly with constraints like CHECK (logdate >= DATE '2006-02-01' AND
> logdate < DATE '2006-03-01'). However, it will work with the BETWEEN
> operator.

The example in the documentation works perfectly well for me.

			regards, tom lane





view thread (2+ messages)

Message-ID: <661806.1723775179@sss.pgh.pa.us>
Permalink:  ../661806.1723775179@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/661806.1723775179@sss.pgh.pa.us

 · 

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-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, hmoustaid.mships@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: constraint_exclusion not working correctly
  In-Reply-To: <661806.1723775179@sss.pgh.pa.us>

* 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