More code review for get_qual_for_list().
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 29 May 2017 18:24:28 +0000 (14:24 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 29 May 2017 18:24:28 +0000 (14:24 -0400)
commitdced55dafead62cfff81a3fedb35acd8e32c9b02
tree578d6c16d871fd45aa0ecf6dd1ee17f7f2a31c98
parent917d91285f187e599039a962d9b869a782390304
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
src/backend/catalog/partition.c