diff --git a/src/common/backend/parser/gram.y b/src/common/backend/parser/gram.y index b85139876..3ca55fb97 100644 --- a/src/common/backend/parser/gram.y +++ b/src/common/backend/parser/gram.y @@ -924,7 +924,7 @@ static void setDelimiterName(core_yyscan_t yyscanner, char*input, VariableSetStm SERIALIZABLE SERVER SESSION SESSION_USER SET SETS SETOF SHARE SHIPPABLE SHOW SHUTDOWN SIBLINGS SIMILAR SIMPLE SIZE SKIP SLAVE SLICE SMALLDATETIME SMALLDATETIME_FORMAT_P SMALLINT SNAPSHOT SOME SOURCE_P SPACE SPILL SPLIT STABLE STANDALONE_P START STARTS STARTWITH STATEMENT STATEMENT_ID STATISTICS STDIN STDOUT STORAGE STORE_P STORED STRATIFY STREAM STRICT_P STRIP_P SUBPARTITION SUBPARTITIONS SUBSCRIPTION SUBSTRING - SYMMETRIC SYNONYM SYSDATE SYSID SYSTEM_P SYS_REFCURSOR STARTING SHOW_ERRORS + SYMMETRIC SYNONYM SYSDATE SYSID SYSTEM_P SYS_REFCURSOR STARTING TABLE TABLES TABLESAMPLE TABLESPACE TARGET TEMP TEMPLATE TEMPORARY TERMINATED TEXT_P THAN THEN TIME TIME_FORMAT_P TIMECAPSULE TIMESTAMP TIMESTAMP_FORMAT_P TIMESTAMPDIFF TINYINT TO TRAILING TRANSACTION TRANSFORM TREAT TRIGGER TRIM TRUE_P diff --git a/src/common/backend/parser/scan.l b/src/common/backend/parser/scan.l index 499ee178f..140090c7a 100755 --- a/src/common/backend/parser/scan.l +++ b/src/common/backend/parser/scan.l @@ -61,8 +61,6 @@ const uint16 ScanKeywordTokens[] = { #undef PG_KEYWORD -/* - /* * Set the type of YYSTYPE. */ diff --git a/src/common/backend/utils/adt/expr_distinct.cpp b/src/common/backend/utils/adt/expr_distinct.cpp index 497327042..e3d505653 100644 --- a/src/common/backend/utils/adt/expr_distinct.cpp +++ b/src/common/backend/utils/adt/expr_distinct.cpp @@ -71,6 +71,53 @@ static void TransferFunctionNumDistinct(PlannerInfo *root, VariableStatData *var bool isJoinVar); static bool CheckFuncArgsForTransferNumDistinct(FuncExpr *funcExpr, Node **varNode); +Oid g_typeCastFuncOids[] = { + /* type cast from bool */ + BOOLTOINT1FUNCOID, BOOLTOINT2FUNCOID, BOOLTOINT4FUNCOID, BOOLTOINT8FUNCOID, BOOLTOTEXTFUNCOID, + + /* type cast from int1 */ + I1TOI2FUNCOID, I1TOI4FUNCOID, I1TOI8FUNCOID, I1TOF4FUNCOID, I1TOF8FUNCOID, INT1TOBPCHARFUNCOID, + INT1TOVARCHARFUNCOID, INT1TONVARCHAR2FUNCOID, INT1TOTEXTFUNCOID, INT1TONUMERICFUNCOID, INT1TOINTERVALFUNCOID, + + /* type cast from int2 */ + I2TOI1FUNCOID, INT2TOINT4FUNCOID, INT2TOFLOAT4FUNCOID, INT2TOFLOAT8FUNCOID, INT2TOBPCHAR, INT2TOTEXTFUNCOID, + INT2TOVARCHARFUNCOID, INT2TOINT8FUNCOID, INT2TONUMERICFUNCOID, INT2TOINTERVALFUNCOID, + + /* type cast from int4 */ + I4TOI1FUNCOID, INT4TOINT2FUNCOID, INT4TOINT8FUNCOID, INT4TOFLOAT8FUNCOID, INTEGER2CASHFUNCOID, + INT4TONUMERICFUNCOID, INT4TOINTERVALFUNCOID, INT4TOHEXFUNCOID, INT4TOBPCHARFUNCOID, INT4TOTEXTFUNCOID, + INT4TOVARCHARFUNCOID, INT4TOCHARFUNCOID, INT4TOCHRFUNCOID, + + /* type cast from int8 */ + I8TOI1FUNCOID, INT8TOINT2FUNCOID, INT8TOINT4FUNCOID, INT8TOBPCHARFUNCOID, INT8TOTEXTFUNCOID, INT8TOVARCHARFUNCOID, + INT8TONUMERICFUNCOID, INT8TOHEXFUNCOID, + + /* type cast from float4/float8 */ + FLOAT4TOBPCHARFUNCOID, FLOAT4TOTEXTFUNCOID, FLOAT4TOVARCHARFUNCOID, FLOAT4TOFLOAT8FUNCOID, + FLOAT4TONUMERICFUNCOID, FLOAT8TOBPCHARFUNCOID, FLOAT8TOINTERVALFUNCOID, FLOAT8TOTEXTFUNCOID, + FLOAT8TOVARCHARFUNCOID, FLOAT8TONUMERICFUNCOID, FLOAT8TOTIMESTAMPFUNCOID, + + /* type cast from numeric */ + NUMERICTOBPCHARFUNCOID, NUMERICTOTEXTFUNCOID, NUMERICTOVARCHARFUNCOID, + + /* type cast from timestamp/date/time */ + DEFAULTFORMATTIMESTAMP2CHARFUNCOID, DEFAULTFORMATTIMESTAMPTZ2CHARFUNCOID, TIMESATMPTOTEXTFUNCOID, + TIMESTAMPTOVARCHARFUNCOID, TIMESTAMP2TIMESTAMPTZFUNCOID, TIMESTAMPTZ2TIMESTAMPFUNCOID, + DATETIMESTAMPTZFUNCOID, DATETOTIMESTAMPFUNCOID, DATETOBPCHARFUNCOID, DATETOVARCHARFUNCOID, DATETOTEXTFUNCOID, + DATEANDTIMETOTIMESTAMPFUNCOID, DTAETIME2TIMESTAMPTZFUNCOID, TIMETOINTERVALFUNCOID, TIMESTAMPZONETOTEXTFUNCOID, + TIME2TIMETZFUNCOID, RELTIMETOINTERVALFUNCOID, + + /* type cast from text */ + TODATEDEFAULTFUNCOID, TODATEFUNCOID, TOTIMESTAMPFUNCOID, TOTIMESTAMPDEFAULTFUNCOID, + TEXTTOREGCLASSFUNCOID, TEXTTOINT1FUNCOID, TEXTTOINT2FUNCOID, TEXTTOINT4FUNCOID, TEXTTOINT8FUNCOID, + TEXTTONUMERICFUNCOID, TEXTTOTIMESTAMP, TIMESTAMPTONEWTIMEZONEFUNCOID, TIMESTAMPTZTONEWTIMEZONEFUNCOID, + HEXTORAWFUNCOID, + + /* type cast from char/varchar/bpchar */ + VARCHARTONUMERICFUNCOID, VARCHARTOINT4FUNCOID, VARCHARTOINT8FUNCOID, VARCHARTOTIMESTAMPFUNCOID, + BPCHARTOINT4FUNCOID, BPCHARTOINT8FUNCOID, BPCHARTONUMERICFUNCOID, BPCHARTOTIMESTAMPFUNCOID, + RTRIM1FUNCOID, BPCHARTEXTFUNCOID, CHARTOBPCHARFUNCOID, CHARTOTEXTFUNCOID +}; static char *GetFunctionNameWithDefault(Oid fnOid) { diff --git a/src/common/interfaces/libpq/frontend_parser/scan.l b/src/common/interfaces/libpq/frontend_parser/scan.l index 0d307d087..58dfc4cd6 100644 --- a/src/common/interfaces/libpq/frontend_parser/scan.l +++ b/src/common/interfaces/libpq/frontend_parser/scan.l @@ -72,8 +72,6 @@ const uint16 ScanKeywordTokens[] = { #undef PG_KEYWORD -/* - /* * Set the type of YYSTYPE. */ diff --git a/src/gausskernel/dbmind/db4ai/executor/algorithms/bayes/bayes_network_internal.cpp b/src/gausskernel/dbmind/db4ai/executor/algorithms/bayes/bayes_network_internal.cpp index 66b1f39c4..87fe1dddc 100644 --- a/src/gausskernel/dbmind/db4ai/executor/algorithms/bayes/bayes_network_internal.cpp +++ b/src/gausskernel/dbmind/db4ai/executor/algorithms/bayes/bayes_network_internal.cpp @@ -201,8 +201,8 @@ void extract_graph(const char *edges_of_network, int num_of_edge, int num_nodes, } if (!validateParamEdges(node_pos, edge_size, substr, substr_len)) { ereport(ERROR, (errmodule(MOD_DB4AI), errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("Incorrect Hyperparameters (edges_of_network unmatch with num_edges), \ - parse failed."))); + errmsg("Incorrect Hyperparameters (edges_of_network unmatch with num_edges), " + "parse failed."))); } all_edges[node_pos++] = atoi(substr); start = end + 1; @@ -219,8 +219,8 @@ void extract_graph(const char *edges_of_network, int num_of_edge, int num_nodes, substr[substr_len] = '\0'; if (!validateParamEdges(node_pos, edge_size, substr, substr_len) || node_pos != edge_size - 1) { ereport(ERROR, (errmodule(MOD_DB4AI), errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("Incorrect Hyperparameters (edges_of_network should match with num_edges), \ - parse failed."))); + errmsg("Incorrect Hyperparameters (edges_of_network should match with num_edges), " + "parse failed."))); } all_edges[node_pos] = atoi(substr); if (!validateParamNodes(all_edges, edge_size, num_nodes)) { diff --git a/src/gausskernel/optimizer/commands/eventcmds.cpp b/src/gausskernel/optimizer/commands/eventcmds.cpp index a7aee72ac..b0bca9838 100755 --- a/src/gausskernel/optimizer/commands/eventcmds.cpp +++ b/src/gausskernel/optimizer/commands/eventcmds.cpp @@ -330,7 +330,7 @@ Datum TranslateArg(char *act_name, Node *act_node) void CheckDefinerPriviledge(char *user_name) { Oid user_oid = GetSysCacheOid1(AUTHNAME, CStringGetDatum(user_name)); - int init_user_id = 10; + Oid init_user_id = 10; if (user_oid != GetUserId()) { if (g_instance.attr.attr_security.enablePrivilegesSeparate) { ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), diff --git a/src/gausskernel/optimizer/commands/tablecmds.cpp b/src/gausskernel/optimizer/commands/tablecmds.cpp index f881f4660..0a4372ab3 100755 --- a/src/gausskernel/optimizer/commands/tablecmds.cpp +++ b/src/gausskernel/optimizer/commands/tablecmds.cpp @@ -23440,6 +23440,8 @@ bool IsPartKeyFunc(Relation rel, bool isPartRel, bool forSubPartition, Partition ereport(ERROR, (errcode(ERRCODE_NODE_ID_MISSMATCH), errmsg("The node type %d is wrong, it must be T_OpExpr or T_FuncExpr", partkeyexpr->type))); + /* suppress warning: -Wreturn-type */ + return false; } static void CheckSubpartitionForAddPartition(Relation rel, Node *partDefState) diff --git a/src/gausskernel/process/postmaster/pagewriter.cpp b/src/gausskernel/process/postmaster/pagewriter.cpp index 3e22761bc..36f4501d4 100755 --- a/src/gausskernel/process/postmaster/pagewriter.cpp +++ b/src/gausskernel/process/postmaster/pagewriter.cpp @@ -1655,7 +1655,7 @@ static void incre_ckpt_aio_callback(struct io_event *event) SegSpace *spc = spc_open(buf_desc->tag.rnode.spcNode, buf_desc->tag.rnode.dbNode, false); seg_physical_read(spc, buf_desc->tag.rnode, buf_desc->tag.forkNum, buf_desc->tag.blockNum, temp_buf); } else if (buf_desc->extra->seg_fileno != EXTENT_INVALID) { - SMGR_READ_STATUS rdStatus = SmgrNetPageCheckRead(buf_desc->tag.rnode.spcNode, buf_desc->tag.rnode.dbNode, + (void)SmgrNetPageCheckRead(buf_desc->tag.rnode.spcNode, buf_desc->tag.rnode.dbNode, buf_desc->extra->seg_fileno, buf_desc->tag.forkNum, buf_desc->extra->seg_blockno, (char *)temp_buf); } diff --git a/src/gausskernel/runtime/executor/execQual.cpp b/src/gausskernel/runtime/executor/execQual.cpp index 7f1cf3838..9e39c192c 100644 --- a/src/gausskernel/runtime/executor/execQual.cpp +++ b/src/gausskernel/runtime/executor/execQual.cpp @@ -1270,7 +1270,6 @@ static Datum ExecEvalUserSetElm(ExprState* exprstate, ExprContext* econtext, boo { UserSetElemState* usestate = (UserSetElemState*)exprstate; UserSetElem* elem = usestate->use; - Node* node = NULL; UserSetElem elemcopy; elemcopy.xpr = elem->xpr; elemcopy.name = elem->name; diff --git a/src/gausskernel/runtime/opfusion/opfusion_insert.cpp b/src/gausskernel/runtime/opfusion/opfusion_insert.cpp index 99e0544c5..45e3e0934 100644 --- a/src/gausskernel/runtime/opfusion/opfusion_insert.cpp +++ b/src/gausskernel/runtime/opfusion/opfusion_insert.cpp @@ -186,8 +186,6 @@ void InsertFusion::refreshParameterIfNecessary() extern HeapTuple searchPgPartitionByParentIdCopy(char parttype, Oid parentId); Datum ComputePartKeyExprTuple(Relation rel, EState *estate, TupleTableSlot *slot, Relation partRel, char* partExprKeyStr) { - Relation pgPartition = NULL; - HeapTuple partitionedTuple = NULL; bool isnull = false; Datum newval = 0; Node* partkeyexpr = NULL; diff --git a/src/gausskernel/storage/buffer/bufmgr.cpp b/src/gausskernel/storage/buffer/bufmgr.cpp index d41c78bc8..8f6153cb4 100644 --- a/src/gausskernel/storage/buffer/bufmgr.cpp +++ b/src/gausskernel/storage/buffer/bufmgr.cpp @@ -2988,7 +2988,7 @@ retry_victim: UnlockBufHdr(buf, buf_state); pg_usleep(1000L); ereport(DEBUG1, (errmodule(MOD_DMS), - errmsg("[%d/%d/%d/%d/%d %d-%d] buf:%d retry release owner", + errmsg("[%d/%d/%d/%d/%d %d-%d] buf:%d retry release owner for %d times", rnode.spcNode, rnode.dbNode, rnode.relNode, rnode.bucketNode, rnode.opt, buf->tag.forkNum, buf->tag.blockNum, buf->buf_id, ++retry_times))); goto retry_victim; diff --git a/src/gausskernel/storage/smgr/segment/segbuffer.cpp b/src/gausskernel/storage/smgr/segment/segbuffer.cpp index 6cb2f1208..6bab9bc38 100644 --- a/src/gausskernel/storage/smgr/segment/segbuffer.cpp +++ b/src/gausskernel/storage/smgr/segment/segbuffer.cpp @@ -813,8 +813,8 @@ retry_victim: MarkDmsBufBeingReleased(buf, true); UnlockBufHdr(buf, buf_state); pg_usleep(1000L); - ereport(DEBUG1, (errmodule(MOD_DMS), errmsg("[%d/%d/%d/%d/%d %d-%d] buf:%d retry release owner", - rnode.spcNode, rnode.dbNode, rnode.relNode, rnode.bucketNode, rnode.opt, + ereport(DEBUG1, (errmodule(MOD_DMS), errmsg("[%d/%d/%d/%d/%d %d-%d] buf:%d retry release owner " + "for %d times", rnode.spcNode, rnode.dbNode, rnode.relNode, rnode.bucketNode, rnode.opt, buf->tag.forkNum, buf->tag.blockNum, buf->buf_id, ++retry_times))); goto retry_victim; } else { /* if returned and !released, we will have to try another victim */ diff --git a/src/include/access/xlogproc.h b/src/include/access/xlogproc.h index cea45e057..e144fefcc 100755 --- a/src/include/access/xlogproc.h +++ b/src/include/access/xlogproc.h @@ -43,9 +43,6 @@ #endif typedef void (*relasexlogreadstate)(void* record); -/* **************define for parse end******************************* */ -#define MIN(_a, _b) ((_a) > (_b) ? (_b) : (_a)) - /* for common blockhead begin */ #define XLogBlockHeadGetInfo(blockhead) ((blockhead)->xl_info) diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h index 946d7e44d..f5832be44 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -933,7 +933,7 @@ SH_SCOPE void SH_DELETE_ITEM(SH_TYPE *tb, SH_ELEMENT_TYPE *entry) */ SH_SCOPE void SH_START_ITERATE(SH_TYPE *tb, SH_ITERATOR *iter) { - int i; + uint64 i; uint64 startelem = PG_UINT64_MAX; /* diff --git a/src/include/utils/expr_distinct.h b/src/include/utils/expr_distinct.h index 16ff9d105..b69a93467 100644 --- a/src/include/utils/expr_distinct.h +++ b/src/include/utils/expr_distinct.h @@ -30,52 +30,6 @@ extern bool IsFunctionTransferNumDistinct(FuncExpr *funcExpr); * The array collects all of the type-cast functions which can transfer number of distinct from any one of * its arguments, other parameters are viewed as Const. */ -static Oid g_typeCastFuncOids[] = { - /* type cast from bool */ - BOOLTOINT1FUNCOID, BOOLTOINT2FUNCOID, BOOLTOINT4FUNCOID, BOOLTOINT8FUNCOID, BOOLTOTEXTFUNCOID, - - /* type cast from int1 */ - I1TOI2FUNCOID, I1TOI4FUNCOID, I1TOI8FUNCOID, I1TOF4FUNCOID, I1TOF8FUNCOID, INT1TOBPCHARFUNCOID, - INT1TOVARCHARFUNCOID, INT1TONVARCHAR2FUNCOID, INT1TOTEXTFUNCOID, INT1TONUMERICFUNCOID, INT1TOINTERVALFUNCOID, - - /* type cast from int2 */ - I2TOI1FUNCOID, INT2TOINT4FUNCOID, INT2TOFLOAT4FUNCOID, INT2TOFLOAT8FUNCOID, INT2TOBPCHAR, INT2TOTEXTFUNCOID, - INT2TOVARCHARFUNCOID, INT2TOINT8FUNCOID, INT2TONUMERICFUNCOID, INT2TOINTERVALFUNCOID, - - /* type cast from int4 */ - I4TOI1FUNCOID, INT4TOINT2FUNCOID, INT4TOINT8FUNCOID, INT4TOFLOAT8FUNCOID, INTEGER2CASHFUNCOID, - INT4TONUMERICFUNCOID, INT4TOINTERVALFUNCOID, INT4TOHEXFUNCOID, INT4TOBPCHARFUNCOID, INT4TOTEXTFUNCOID, - INT4TOVARCHARFUNCOID, INT4TOCHARFUNCOID, INT4TOCHRFUNCOID, - - /* type cast from int8 */ - I8TOI1FUNCOID, INT8TOINT2FUNCOID, INT8TOINT4FUNCOID, INT8TOBPCHARFUNCOID, INT8TOTEXTFUNCOID, INT8TOVARCHARFUNCOID, - INT8TONUMERICFUNCOID, INT8TOHEXFUNCOID, - - /* type cast from float4/float8 */ - FLOAT4TOBPCHARFUNCOID, FLOAT4TOTEXTFUNCOID, FLOAT4TOVARCHARFUNCOID, FLOAT4TOFLOAT8FUNCOID, - FLOAT4TONUMERICFUNCOID, FLOAT8TOBPCHARFUNCOID, FLOAT8TOINTERVALFUNCOID, FLOAT8TOTEXTFUNCOID, - FLOAT8TOVARCHARFUNCOID, FLOAT8TONUMERICFUNCOID, FLOAT8TOTIMESTAMPFUNCOID, - - /* type cast from numeric */ - NUMERICTOBPCHARFUNCOID, NUMERICTOTEXTFUNCOID, NUMERICTOVARCHARFUNCOID, - - /* type cast from timestamp/date/time */ - DEFAULTFORMATTIMESTAMP2CHARFUNCOID, DEFAULTFORMATTIMESTAMPTZ2CHARFUNCOID, TIMESATMPTOTEXTFUNCOID, - TIMESTAMPTOVARCHARFUNCOID, TIMESTAMP2TIMESTAMPTZFUNCOID, TIMESTAMPTZ2TIMESTAMPFUNCOID, - DATETIMESTAMPTZFUNCOID, DATETOTIMESTAMPFUNCOID, DATETOBPCHARFUNCOID, DATETOVARCHARFUNCOID, DATETOTEXTFUNCOID, - DATEANDTIMETOTIMESTAMPFUNCOID, DTAETIME2TIMESTAMPTZFUNCOID, TIMETOINTERVALFUNCOID, TIMESTAMPZONETOTEXTFUNCOID, - TIME2TIMETZFUNCOID, RELTIMETOINTERVALFUNCOID, - - /* type cast from text */ - TODATEDEFAULTFUNCOID, TODATEFUNCOID, TOTIMESTAMPFUNCOID, TOTIMESTAMPDEFAULTFUNCOID, - TEXTTOREGCLASSFUNCOID, TEXTTOINT1FUNCOID, TEXTTOINT2FUNCOID, TEXTTOINT4FUNCOID, TEXTTOINT8FUNCOID, - TEXTTONUMERICFUNCOID, TEXTTOTIMESTAMP, TIMESTAMPTONEWTIMEZONEFUNCOID, TIMESTAMPTZTONEWTIMEZONEFUNCOID, - HEXTORAWFUNCOID, - - /* type cast from char/varchar/bpchar */ - VARCHARTONUMERICFUNCOID, VARCHARTOINT4FUNCOID, VARCHARTOINT8FUNCOID, VARCHARTOTIMESTAMPFUNCOID, - BPCHARTOINT4FUNCOID, BPCHARTOINT8FUNCOID, BPCHARTONUMERICFUNCOID, BPCHARTOTIMESTAMPFUNCOID, - RTRIM1FUNCOID, BPCHARTEXTFUNCOID, CHARTOBPCHARFUNCOID, CHARTOTEXTFUNCOID -}; +extern Oid g_typeCastFuncOids[]; #endif /* EXPR_DISTINCT_H */