Fix multiple problems with satisfies_hash_partition

Enterprise / PostgreSQL - Robert Haas [postgresql.org] - 21 November 2017 18:06 EST

Fix the function header comment to describe the actual behavior. Check that table OID, modulus, and remainder arguments are not NULL before accessing them. Check that the modulus and remainder are sensible. If the table OID doesn't exist, return NULL instead of emitting an internal error, similar to what we do elsewhere. Check that the actual argument types match, or at least are binary coercible to, the expected argument types. Correctly handle invocation of this function using the VARIADIC syntax. Add regression tests.

Robert Haas and Amul Sul, per a report by Andreas Seltenreich and subsequent followup investigation.

Discussion: http://postgr.es/m/871sl4sdrv.fsf@ansel.ydns.eu

f3b0897a12 Fix multiple problems with satisfies_hash_partition.
src/backend/catalog/partition.c | 202 +++++++++++++++++++++++++++-----
src/test/regress/expected/hash_part.out | 113 ++++++++++++++++++
src/test/regress/parallel_schedule | 2 +-
src/test/regress/serial_schedule | 1 +
src/test/regress/sql/hash_part.sql | 90 ++++++++++++++
5 files changed, 377 insertions(+), 31 deletions(-)

Upstream: git.postgresql.org


  • Share