mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
Fix improper NULL handling in list partitioning code.
The previous logic was wrong when the value was NULL but there was no partition for NULL. Amit Langote, reviewed by Jeevan Ladhe Discussion: http://postgr.es/m/d64f8498-70eb-3c88-b56d-c54fd3b0500f@lab.ntt.co.jp
This commit is contained in:
@@ -1729,10 +1729,14 @@ get_partition_for_tuple(PartitionDispatch *pd,
|
||||
errmsg("range partition key of row contains null")));
|
||||
}
|
||||
|
||||
if (partdesc->boundinfo->has_null && isnull[0])
|
||||
/* Tuple maps to the null-accepting list partition */
|
||||
/*
|
||||
* A null partition key is only acceptable if null-accepting list
|
||||
* partition exists.
|
||||
*/
|
||||
cur_index = -1;
|
||||
if (isnull[0] && partdesc->boundinfo->has_null)
|
||||
cur_index = partdesc->boundinfo->null_index;
|
||||
else
|
||||
else if (!isnull[0])
|
||||
{
|
||||
/* Else bsearch in partdesc->boundinfo */
|
||||
bool equal = false;
|
||||
|
Reference in New Issue
Block a user