pgsql: Change bms_add_range to be a no-op for empty ranges

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Change bms_add_range to be a no-op for empty ranges
Date: 2018-07-30 22:50:44
Message-ID: E1fkH00-0005f6-Hr@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Change bms_add_range to be a no-op for empty ranges

In commit 84940644de93, bms_add_range was added with an API to fail with
an error if an empty range was specified. This seems arbitrary and
unhelpful, so turn that case into a no-op instead. Callers that require
further verification on the arguments or result can apply them by
themselves.

This fixes the bug that partition pruning throws an API error for a case
involving the default partition of a default partition, as in the
included test case.

Reported-by: Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>
Diagnosed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/16590.1532622503@sss.pgh.pa.us

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/192d1bbf99699de76473184c57fff9ff4b4246f4

Modified Files
--------------
src/backend/nodes/bitmapset.c | 7 +++++--
src/test/regress/expected/partition_prune.out | 15 +++++++++++++++
src/test/regress/sql/partition_prune.sql | 7 +++++++
3 files changed, 27 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-07-30 23:11:23 pgsql: Remove dead code left behind by 1b6801051.
Previous Message Tom Lane 2018-07-30 22:04:49 pgsql: Ensure we build generated headers at the start of some more case