1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-28 11:44:57 +03:00

If a range-partitioned table has no default partition, reject null keys.

Commit 4e5fe9ad19 introduced this
problem.  Also add a test so it doesn't get broken again.

Report by Rushabh Lathia.  Fix by Amit Langote.  Reviewed by Rushabh
Lathia and Amul Sul.  Tweaked by me.

Discussion: http://postgr.es/m/CAGPqQf0Y1iJyk4QJBdMf=pS9i6Q0JUMM_h5-qkR3OMJ-e04PyA@mail.gmail.com
This commit is contained in:
Robert Haas
2017-11-28 14:11:16 -05:00
parent 62546b4357
commit 2d7950f222
3 changed files with 9 additions and 3 deletions

View File

@@ -2553,11 +2553,10 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull)
*/
for (i = 0; i < key->partnatts; i++)
{
if (isnull[i] &&
partition_bound_has_default(partdesc->boundinfo))
if (isnull[i])
{
range_partkey_has_null = true;
part_index = partdesc->boundinfo->default_index;
break;
}
}