diff --git a/src/common/backend/nodes/copyfuncs.cpp b/src/common/backend/nodes/copyfuncs.cpp index 07fbbb484..4ba7b7b17 100644 --- a/src/common/backend/nodes/copyfuncs.cpp +++ b/src/common/backend/nodes/copyfuncs.cpp @@ -2576,6 +2576,9 @@ static Aggref* _copyAggref(const Aggref* from) COPY_SCALAR_FIELD(aggkind); COPY_SCALAR_FIELD(agglevelsup); COPY_LOCATION_FIELD(location); + COPY_NODE_FIELD(aggargtypes); + COPY_SCALAR_FIELD(aggsplit); + COPY_SCALAR_FIELD(aggtranstype); return newnode; } diff --git a/src/common/backend/nodes/equalfuncs.cpp b/src/common/backend/nodes/equalfuncs.cpp index 5da26cb5d..0d1ad79ed 100644 --- a/src/common/backend/nodes/equalfuncs.cpp +++ b/src/common/backend/nodes/equalfuncs.cpp @@ -233,6 +233,8 @@ static bool _equalAggref(const Aggref* a, const Aggref* b) COMPARE_SCALAR_FIELD(aggkind); COMPARE_SCALAR_FIELD(agglevelsup); COMPARE_LOCATION_FIELD(location); + COMPARE_NODE_FIELD(aggargtypes); + COMPARE_SCALAR_FIELD(aggsplit); return true; } diff --git a/src/common/backend/nodes/outfuncs.cpp b/src/common/backend/nodes/outfuncs.cpp index 5991c615b..704c50eb5 100755 --- a/src/common/backend/nodes/outfuncs.cpp +++ b/src/common/backend/nodes/outfuncs.cpp @@ -2384,6 +2384,11 @@ static void _outAggref(StringInfo str, Aggref* node) WRITE_TYPEINFO_FIELD(aggtype); WRITE_TYPEINFO_FIELD(aggtrantype); + if (t_thrd.proc->workingVersionNum >= TIMESCALE_DB_VERSION_NUM){ + WRITE_NODE_FIELD(aggargtypes); + WRITE_INT_FIELD(aggsplit); + WRITE_OID_FIELD(aggtranstype); + } } static void _outGroupingFunc(StringInfo str, const GroupingFunc* node) @@ -3450,6 +3455,9 @@ static void _outRelOptInfo(StringInfo str, RelOptInfo* node) WRITE_NODE_FIELD(joininfo); WRITE_BOOL_FIELD(has_eclass_joins); WRITE_UINT_FIELD(num_data_nodes); + if (t_thrd.proc->workingVersionNum >= TIMESCALE_DB_VERSION_NUM){ + WRITE_NODE_FIELD(partial_pathlist); + } } static void _outIndexOptInfo(StringInfo str, IndexOptInfo* node) @@ -3472,6 +3480,9 @@ static void _outIndexOptInfo(StringInfo str, IndexOptInfo* node) WRITE_BOOL_FIELD(unique); WRITE_BOOL_FIELD(immediate); WRITE_BOOL_FIELD(hypothetical); + if (t_thrd.proc->workingVersionNum >= TIMESCALE_DB_VERSION_NUM){ + WRITE_NODE_FIELD(indrestrictinfo); + } } static void _outEquivalenceClass(StringInfo str, EquivalenceClass* node) diff --git a/src/common/backend/nodes/readfuncs.cpp b/src/common/backend/nodes/readfuncs.cpp index f84bbae59..13ad3d18d 100755 --- a/src/common/backend/nodes/readfuncs.cpp +++ b/src/common/backend/nodes/readfuncs.cpp @@ -2227,6 +2227,18 @@ static Aggref* _readAggref(void) READ_LOCATION_FIELD(location); READ_TYPEINFO_FIELD(aggtype); READ_TYPEINFO_FIELD(aggtrantype); + IF_EXIST(aggargtypes) + { + READ_NODE_FIELD(aggargtypes); + } + IF_EXIST(aggsplit) + { + READ_INT_FIELD(aggsplit); + } + IF_EXIST(aggtranstype) + { + READ_OID_FIELD(aggtranstype); + } READ_DONE(); } diff --git a/src/common/backend/utils/init/globals.cpp b/src/common/backend/utils/init/globals.cpp index 9acbdf5b9..bb7208140 100644 --- a/src/common/backend/utils/init/globals.cpp +++ b/src/common/backend/utils/init/globals.cpp @@ -75,7 +75,7 @@ bool will_shutdown = false; * NEXT | 92899 | ? | ? * ********************************************/ -const uint32 GRAND_VERSION_NUM = 92900; +const uint32 GRAND_VERSION_NUM = 92901; /******************************************** * 2.VERSION NUM FOR EACH FEATURE @@ -183,6 +183,7 @@ const uint32 GTMLITE_VERSION_NUM = 92110; const uint32 PREDPUSH_VERSION_NUM = 92096; const uint32 SUBLINKPULLUP_VERSION_NUM = 92094; const uint32 PARTIALPUSH_VERSION_NUM = 92087; +const uint32 TIMESCALE_DB_VERSION_NUM = 92901; /* This variable indicates wheather the instance is in progress of upgrade as a whole */ uint32 volatile WorkingGrandVersionNum = GRAND_VERSION_NUM; diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 1efaf07fe..aa36939fc 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -128,6 +128,7 @@ extern const uint32 CREATE_INDEX_IF_NOT_EXISTS_VERSION_NUM; extern const uint32 SLOW_SQL_VERSION_NUM; extern const uint32 INDEX_HINT_VERSION_NUM; extern const uint32 CREATE_TABLE_AS_VERSION_NUM; +extern const uint32 TIMESCALE_DB_VERSION_NUM; extern void register_backend_version(uint32 backend_version); extern bool contain_backend_version(uint32 version_number); diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 84b5538c6..4dcb42fc4 100755 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -581,6 +581,8 @@ typedef struct ResultRelInfo { int ri_NumUpdatedNeeded; List* ri_WithCheckOptions; List* ri_WithCheckOptionExprs; + + ProjectionInfo* ri_updateWhere; /* list of ON CONFLICT DO UPDATE exprs (qual)*/ } ResultRelInfo; /* bloom filter controller */ diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 3d1e2f16c..c92b744d8 100755 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -830,9 +830,20 @@ typedef enum NodeTag { T_UserVar, T_CharsetCollateOptions, T_FunctionSources, - + /* ndpplugin tag */ - T_NdpScanCondition + T_NdpScanCondition, + + /* timescaledb plugin tag */ + T_ModifyTablePath, + T_AggPath, + T_WindowAggPath, + T_SortPath, + T_MinMaxAggPath, + T_GatherPath, + T_ForeignKeyCacheInfo, + T_Gather + } NodeTag; /* if you add to NodeTag also need to add nodeTagToString */ diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 2daaa373a..f003da36d 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -294,6 +294,9 @@ typedef struct Aggref { char aggkind; /* aggregate kind (see pg_aggregate.h) */ Index agglevelsup; /* > 0 if agg belongs to outer query */ int location; /* token location, or -1 if unknown */ + List* aggargtypes; /* type Oids of direct and aggregated args */ + int aggsplit; /* expected agg-splitting mode of parent Agg */ + Oid aggtranstype; /* type Oid of aggregate's transition value */ } Aggref; /* diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 983a7a30f..c9c494cd3 100755 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -811,6 +811,8 @@ typedef struct RelOptInfo { RelOptInfo* base_rel; unsigned int num_data_nodes = 0; //number of distributing data nodes + + List* partial_pathlist; /* partial Paths */ } RelOptInfo; /* @@ -884,6 +886,7 @@ typedef struct IndexOptInfo { bool amsearchnulls; /* can AM search for NULL/NOT NULL entries? */ bool amhasgettuple; /* does AM have amgettuple interface? */ bool amhasgetbitmap; /* does AM have amgetbitmap interface? */ + List* indrestrictinfo;/* parent relation's baserestrictinfo list */ } IndexOptInfo; /*