pgsql: More code review for get_qual_for_list().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: More code review for get_qual_for_list().
Date: 2017-05-29 18:24:36
Message-ID: E1dFPLI-0005Bb-De@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

More code review for get_qual_for_list().

Avoid trashing the input PartitionBoundSpec; while that might be safe for
current callers, it's certainly trouble waiting to happen. In the same
vein, make sure that all of the result data structure is freshly palloc'd,
rather than some of it being pointers into the input data structures
(which we don't know the lifespans of).

Simplify the logic for tacking on IS NULL or IS NOT NULL conditions some
more; commit 85c2b9a15 left a lot on the table there. And rearrange the
construction of the nodes into (what seems to me) a more logical order.

In passing, make sure that get_qual_for_range() also returns a freshly
palloc'd structure, since there's no value in having that guarantee for
only one kind of partitioning. And improve some comments there.

Jeevan Ladhe, with further tweaking by me

Discussion: https://postgr.es/m/CAOgcT0MAcYoMs93W80iTUf_dP36=1mZQzeUk+nnwY_-qWDrCfw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dced55dafead62cfff81a3fedb35acd8e32c9b02

Modified Files
--------------
src/backend/catalog/partition.c | 126 +++++++++++++++++++---------------------
1 file changed, 61 insertions(+), 65 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-05-29 19:19:26 pgsql: Allow NumericOnly to be "+ FCONST".
Previous Message Magnus Hagander 2017-05-29 14:30:00 pgsql: Fix typo in comment