sync all inner code

This commit is contained in:
yanghao
2023-03-07 20:32:34 +08:00
parent 93cf8543c1
commit 60c0c33328
127 changed files with 1220 additions and 556 deletions

View File

@ -95,17 +95,19 @@
*/
#define NUMERIC_DSCALE_MASK 0x3FFF
#define NUMERIC_SIGN(n) \
(NUMERIC_HEADER_IS_SHORT(n) ? (((n)->choice.n_short.n_header & NUMERIC_SHORT_SIGN_MASK) ? NUMERIC_NEG : NUMERIC_POS) \
: NUMERIC_FLAGBITS(n))
#define NUMERIC_DSCALE(n) \
(NUMERIC_HEADER_IS_SHORT((n)) ? ((n)->choice.n_short.n_header & NUMERIC_SHORT_DSCALE_MASK) >> NUMERIC_SHORT_DSCALE_SHIFT \
: ((n)->choice.n_long.n_sign_dscale & NUMERIC_DSCALE_MASK))
#define NUMERIC_WEIGHT(n) \
(NUMERIC_HEADER_IS_SHORT((n)) \
? (((n)->choice.n_short.n_header & NUMERIC_SHORT_WEIGHT_SIGN_MASK ? ~NUMERIC_SHORT_WEIGHT_MASK : 0) | \
((n)->choice.n_short.n_header & NUMERIC_SHORT_WEIGHT_MASK)) \
: ((n)->choice.n_long.n_weight))
#define NUMERIC_SIGN(n) \
(NUMERIC_HEADER_IS_SHORT(n) \
? (((n)->choice.n_short.n_header & NUMERIC_SHORT_SIGN_MASK) ? NUMERIC_NEG : NUMERIC_POS) \
: NUMERIC_FLAGBITS(n))
#define NUMERIC_DSCALE(n) \
(NUMERIC_HEADER_IS_SHORT((n)) \
? ((n)->choice.n_short.n_header & NUMERIC_SHORT_DSCALE_MASK) >> NUMERIC_SHORT_DSCALE_SHIFT \
: ((n)->choice.n_long.n_sign_dscale & NUMERIC_DSCALE_MASK))
#define NUMERIC_WEIGHT(n) \
(NUMERIC_HEADER_IS_SHORT((n)) \
? (((n)->choice.n_short.n_header & NUMERIC_SHORT_WEIGHT_SIGN_MASK ? ~NUMERIC_SHORT_WEIGHT_MASK : 0) | \
((n)->choice.n_short.n_header & NUMERIC_SHORT_WEIGHT_MASK)) \
: ((n)->choice.n_long.n_weight))
#define NUMERIC_DIGITS(num) (NUMERIC_HEADER_IS_SHORT(num) ? (num)->choice.n_short.n_data : (num)->choice.n_long.n_data)
#define NUMERIC_NDIGITS(num) ((VARSIZE(num) - NUMERIC_HEADER_SIZE(num)) / sizeof(NumericDigit))

View File

@ -263,32 +263,32 @@ typedef struct HashPartitionMap {
} \
} while (0)
#define partitionRoutingForValueEqual(rel, keyValue, valueLen, topClosed, result) \
do { \
(keyValue) = transformConstIntoPartkeyType(((rel)->rd_att->attrs), GetPartitionKey((rel)->partMap), (keyValue), \
(valueLen)); \
if ((rel)->partMap->type == PART_TYPE_LIST) { \
(result)->partArea = PART_AREA_LIST; \
(result)->partitionId = \
getListPartitionOid(((rel)->partMap), (keyValue), (valueLen), &((result)->partSeq), topClosed); \
if ((result)->partSeq < 0) { \
(result)->fileExist = false; \
} else { \
(result)->fileExist = true; \
} \
} else if ((rel)->partMap->type == PART_TYPE_HASH) { \
(result)->partArea = PART_AREA_HASH; \
(result)->partitionId = \
getHashPartitionOid(((rel)->partMap), (keyValue), &((result)->partSeq), topClosed); \
if ((result)->partSeq < 0) { \
(result)->fileExist = false; \
} else { \
(result)->fileExist = true; \
} \
} else { \
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), \
errmsg("Unsupported partition strategy:%d", (rel)->partMap->type))); \
} \
#define partitionRoutingForValueEqual(rel, keyValue, valueLen, topClosed, result) \
do { \
(keyValue) = transformConstIntoPartkeyType(((rel)->rd_att->attrs), GetPartitionKey((rel)->partMap), \
(keyValue), (valueLen)); \
if ((rel)->partMap->type == PART_TYPE_LIST) { \
(result)->partArea = PART_AREA_LIST; \
(result)->partitionId = \
getListPartitionOid(((rel)->partMap), (keyValue), (valueLen), &((result)->partSeq), topClosed); \
if ((result)->partSeq < 0) { \
(result)->fileExist = false; \
} else { \
(result)->fileExist = true; \
} \
} else if ((rel)->partMap->type == PART_TYPE_HASH) { \
(result)->partArea = PART_AREA_HASH; \
(result)->partitionId = \
getHashPartitionOid(((rel)->partMap), (keyValue), &((result)->partSeq), topClosed); \
if ((result)->partSeq < 0) { \
(result)->fileExist = false; \
} else { \
(result)->fileExist = true; \
} \
} else { \
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), \
errmsg("Unsupported partition strategy:%d", (rel)->partMap->type))); \
} \
} while (0)
typedef enum PruningResultState { PRUNING_RESULT_EMPTY, PRUNING_RESULT_SUBSET, PRUNING_RESULT_FULL } PruningResultState;

View File

@ -1590,7 +1590,7 @@ extern PLpgSQL_variable* plpgsql_build_variable(const char* refname, int lineno,
PLpgSQL_variable* plpgsql_build_varrayType(const char* refname, int lineno, PLpgSQL_type* dtype, bool add2namespace);
PLpgSQL_variable* plpgsql_build_tableType(const char* refname, int lineno, PLpgSQL_type* dtype, bool add2namespace);
extern PLpgSQL_rec_type* plpgsql_build_rec_type(const char* typname, int lineno, List* list, bool add2namespace);
extern PLpgSQL_rec* plpgsql_build_record(const char* refname, int lineno, bool add2namespace);
extern PLpgSQL_rec* plpgsql_build_record(const char* refname, int lineno, bool add2namespace, TupleDesc tupleDesc);
extern int plpgsql_recognize_err_condition(const char* condname, bool allow_sqlstate);
extern PLpgSQL_condition* plpgsql_parse_err_condition(char* condname);
extern PLpgSQL_condition* plpgsql_parse_err_condition_b(const char* condname);