mirror of
https://github.com/postgres/postgres.git
synced 2025-07-21 16:02:15 +03:00
Fix uninitialized memory reference.
Without this, when partdesc->nparts == 0, we end up calling ExecBuildSlotPartitionKeyDescription without initializing values and isnull. Reported by Coverity via Michael Paquier. Patch by Michael Paquier, reviewed and revised by Amit Langote. Discussion: http://postgr.es/m/CAB7nPqQ3mwkdMoPY-ocgTpPnjd8TKOadMxdTtMLvEzF8480Zfg@mail.gmail.com
This commit is contained in:
@ -206,13 +206,6 @@ ExecFindPartition(ResultRelInfo *resultRelInfo, PartitionDispatch *pd,
|
||||
slot = myslot;
|
||||
}
|
||||
|
||||
/* Quick exit */
|
||||
if (partdesc->nparts == 0)
|
||||
{
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract partition key from tuple. Expression evaluation machinery
|
||||
* that FormPartitionKeyDatum() invokes expects ecxt_scantuple to
|
||||
@ -223,6 +216,17 @@ ExecFindPartition(ResultRelInfo *resultRelInfo, PartitionDispatch *pd,
|
||||
*/
|
||||
ecxt->ecxt_scantuple = slot;
|
||||
FormPartitionKeyDatum(parent, slot, estate, values, isnull);
|
||||
|
||||
/*
|
||||
* Nothing for get_partition_for_tuple() to do if there are no
|
||||
* partitions to begin with.
|
||||
*/
|
||||
if (partdesc->nparts == 0)
|
||||
{
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
cur_index = get_partition_for_tuple(rel, values, isnull);
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user