fix memcheck issue: 1 to_number(), 2 core of spliting hash partition by range-gram

This commit is contained in:
gentle_hu
2021-06-24 18:19:44 +08:00
parent 6adcb2dbac
commit f999b05a0e
2 changed files with 12 additions and 7 deletions

View File

@ -3910,6 +3910,16 @@ List* transformAlterTableStmt(Oid relid, AlterTableStmt* stmt, const char* query
break;
case AT_SplitPartition:
if (!RELATION_IS_PARTITIONED(rel))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmodule(MOD_OPT),
errmsg("can not split partition against NON-PARTITIONED table")));
if (rel->partMap->type == PART_TYPE_LIST || rel->partMap->type == PART_TYPE_HASH) {
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("can not split LIST/HASH partition table")));
}
/* transform the boundary of range partition: from A_Const into Const */
splitDefState = (SplitPartitionState*)cmd->def;
if (!PointerIsValid(splitDefState->split_point)) {
@ -3930,12 +3940,6 @@ List* transformAlterTableStmt(Oid relid, AlterTableStmt* stmt, const char* query
Const* upBound = NULL;
Oid srcPartOid = InvalidOid;
if (!RELATION_IS_PARTITIONED(rel))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmodule(MOD_OPT),
errmsg("can not split partition against NON-PARTITIONED table")));
/* get partition number */
partNum = getNumberOfPartitions(rel);
@ -5369,6 +5373,7 @@ static void get_src_partition_bound(Relation partTableRel, Oid srcPartOid, Const
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("CAN NOT get detail info from a partitioned relation WITHOUT specified partition.")));
Assert(partTableRel->partMap->type == PART_TYPE_RANGE || partTableRel->partMap->type == PART_TYPE_INTERVAL);
partMap = (RangePartitionMap*)partTableRel->partMap;
srcPartSeq = partOidGetPartSequence(partTableRel, srcPartOid) - 1;

View File

@ -5561,7 +5561,7 @@ static void NUM_numpart_from_char(NUMProc* Np, int id, int plen, int& tmp_len)
* locale sign expected - last read char was NUM_0/9 or NUM_DEC - and
* next char is not digit
*/
if (IS_LSIGN(Np->Num) && isread && (Np->inout_p + 1) <= Np->inout + plen &&
if (IS_LSIGN(Np->Num) && isread && (Np->inout_p + 1) < Np->inout + plen &&
!isdigit((unsigned char)*(Np->inout_p + 1))) {
int x;
char* tmp = Np->inout_p++;