diff --git a/third_party/dependency/postgis/extension_dependency.patch b/third_party/dependency/postgis/extension_dependency.patch new file mode 100644 index 000000000..3f3ad9751 --- /dev/null +++ b/third_party/dependency/postgis/extension_dependency.patch @@ -0,0 +1,139 @@ +From 0c61cbbb0f509153bd6a07d37ba4866696e9527e Mon Sep 17 00:00:00 2001 +From: chen******** <13*******7@qq.com> +Date: Fri, 18 Sep 2020 20:13:05 +0800 +Subject: [PATCH] patch + +--- + contrib/postgis/extension_dependency.h | 26 ++++++++++++++++++++++---- + 1 file changed, 22 insertions(+), 4 deletions(-) + +diff --git a/contrib/postgis/extension_dependency.h b/contrib/postgis/extension_dependency.h +index 3f0117e..de9c443 100644 +--- a/contrib/postgis/extension_dependency.h ++++ b/contrib/postgis/extension_dependency.h +@@ -1,7 +1,5 @@ + /* +- * Portions Copyright (c) 2020 Huawei Technologies Co.,Ltd. +- * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group +- * Portions Copyright (c) 1994, Regents of the University of California ++ * Copyright (c) 2020 Huawei Technologies Co.,Ltd. + * + * openGauss is licensed under Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. +@@ -49,7 +47,11 @@ + #include "utils/hsearch.h" + #include "utils/palloc.h" + #include "utils/syscache.h" +- ++#include "executor/spi.h" ++#include "executor/executor.h" ++#include "utils/builtins.h" ++#include "catalog/pg_proc.h" ++#include "funcapi.h" + typedef int Buffer; + typedef uint16 StrategyNumber; + typedef int16 AttrNumber; +@@ -94,6 +96,7 @@ typedef uint16 OffsetNumber; + typedef struct GISTPageOpaqueData GISTPageOpaqueData; + typedef GISTPageOpaqueData* GISTPageOpaque; + ++#if 0 + typedef struct SPITupleTable { + MemoryContext tuptabcxt; /* memory context of result table */ + uint32 alloced; /* of alloced vals */ +@@ -101,14 +104,17 @@ typedef struct SPITupleTable { + TupleDesc tupdesc; /* tuple descriptor */ + HeapTuple* vals; /* tuples */ + } SPITupleTable; ++#endif + + /* funcapi.h */ ++#if 0 + typedef enum TypeFuncClass { + TYPEFUNC_SCALAR, /* scalar result type */ + TYPEFUNC_COMPOSITE, /* determinable rowtype result */ + TYPEFUNC_RECORD, /* indeterminate rowtype result */ + TYPEFUNC_OTHER /* bogus type, eg pseudotype */ + } TypeFuncClass; ++#endif + + /* nodes/execnodes.h */ + typedef struct ExprContext ExprContext; +@@ -116,13 +122,16 @@ typedef struct ExprContext ExprContext; + typedef struct Tuplestorestate Tuplestorestate; + + /* nodes/execnodes.h */ ++#if 0 + typedef enum { + ExprSingleResult, /* expression does not return a set */ + ExprMultipleResult, /* this result is an element of a set */ + ExprEndResult /* there are no more elements in the set */ + } ExprDoneCond; ++#endif + + /* nodes/execnodes.h */ ++#if 0 + typedef enum { + SFRM_ValuePerCall = 0x01, /* one value returned per call */ + SFRM_Materialize = 0x02, /* result set instantiated in Tuplestore */ +@@ -144,10 +153,12 @@ typedef struct ReturnSetInfo { + Tuplestorestate* setResult; /* holds the complete returned tuple set */ + TupleDesc setDesc; /* actual descriptor for returned tuples */ + } ReturnSetInfo; ++#endif + + typedef PageHeaderData* PageHeader; + + /* funcapi.h */ ++#if 0 + typedef struct AttInMetadata { + /* full TupleDesc */ + TupleDesc tupdesc; +@@ -158,8 +169,10 @@ typedef struct AttInMetadata { + /* array of attribute typmod */ + int32* atttypmods; + } AttInMetadata; ++#endif + + /* funcapi.h */ ++#if 0 + typedef struct FuncCallContext { + /* + * Number of times we've been called before +@@ -223,6 +236,7 @@ typedef struct FuncCallContext { + */ + TupleDesc tuple_desc; + } FuncCallContext; ++#endif + + /* windowapi.h */ + typedef struct WindowAggState WindowAggState; +@@ -274,14 +288,17 @@ typedef struct GIST_SPLITVEC { + bool spl_rdatum_exists; /* true, if spl_rdatum already exists. */ + } GIST_SPLITVEC; + ++#if 0 + typedef struct ItstDisKey { + List* superset_keys; /* list of superset keys list, several members possible */ + List* matching_keys; /* list of exact matching keys, */ + } ItstDisKey; ++#endif + + /* odes/relation.h */ + typedef struct PlannerGlobal PlannerGlobal; + ++#if 0 + typedef struct PlannerInfo { + NodeTag type; + +@@ -474,6 +491,7 @@ typedef struct PlannerInfo { + bool is_under_recursive_tree; + bool has_recursive_correlated_rte; /* true if any RTE correlated with recursive cte */ + } PlannerInfo; ++#endif + + /* commands/vacuum.h */ + typedef struct VacAttrStats VacAttrStats; +-- +2.6.4.windows.1 + diff --git a/third_party/dependency/postgis/postgis.patch b/third_party/dependency/postgis/postgis.patch new file mode 100644 index 000000000..d97922835 --- /dev/null +++ b/third_party/dependency/postgis/postgis.patch @@ -0,0 +1,248 @@ +From c53717b64050b2a66d5f5af53fa79edc038b5b5d Mon Sep 17 00:00:00 2001 +From: chen******** <13*******7@qq.com> +Date: Fri, 18 Sep 2020 19:21:43 +0800 +Subject: [PATCH] patch + +--- + postgis--2.4.2.sql | 2 +- + topology/postgis_topology.c | 50 ++++++++++++++++++++++----------------------- + 2 files changed, 26 insertions(+), 26 deletions(-) + +diff --git a/postgis--2.4.2.sql b/postgis--2.4.2.sql +index 74a34bf..b48f739 100644 +--- a/postgis--2.4.2.sql ++++ b/postgis--2.4.2.sql +@@ -1720,7 +1720,7 @@ CREATE TABLE spatial_ref_sys ( + auth_srid integer, + srtext varchar(2048), + proj4text varchar(2048) +-)DISTRIBUTE BY REPLICATION; ++); + + + ----------------------------------------------------------------------- +diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c +index 5718b88..717edee 100644 +--- a/topology/postgis_topology.c ++++ b/topology/postgis_topology.c +@@ -965,7 +965,7 @@ cb_getEdgeByFace(const LWT_BE_TOPOLOGY* topo, + POSTGIS_DEBUGF(1, "data_changed is %d", topo->be_data->data_changed); + + spi_result = SPI_execute_with_args(sql->data, nargs, argtypes, values, NULL, +- !topo->be_data->data_changed, 0); ++ !topo->be_data->data_changed, 0, NULL); + pfree(array_ids); /* not needed anymore */ + if ( gser ) pfree(gser); /* not needed anymore */ + MemoryContextSwitchTo( oldcontext ); /* switch back */ +@@ -2557,7 +2557,7 @@ cb_getFaceContainingPoint( const LWT_BE_TOPOLOGY* topo, const LWPOINT* pt ) + values[0] = PointerGetDatum(pts); + argtypes[0] = topo->geometryOID; + spi_result = SPI_execute_with_args(sql->data, 1, argtypes, values, NULL, +- !topo->be_data->data_changed, 1); ++ !topo->be_data->data_changed, 1, NULL); + MemoryContextSwitchTo( oldcontext ); /* switch back */ + pfree(pts); /* not needed anymore */ + if ( spi_result != SPI_OK_SELECT ) { +@@ -2992,7 +2992,7 @@ _PG_fini(void) + } + + /* ST_ModEdgeSplit(atopology, anedge, apoint) */ +-Datum ST_ModEdgeSplit(PG_FUNCTION_ARGS); ++extern "C" Datum ST_ModEdgeSplit(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_ModEdgeSplit); + Datum ST_ModEdgeSplit(PG_FUNCTION_ARGS) + { +@@ -3057,8 +3057,8 @@ Datum ST_ModEdgeSplit(PG_FUNCTION_ARGS) + } + + /* ST_NewEdgesSplit(atopology, anedge, apoint) */ +-Datum ST_NewEdgesSplit(PG_FUNCTION_ARGS); +-PG_FUNCTION_INFO_V1(ST_NewEdgesSplit); ++extern "C" Datum ST_NewEdgesSplit(PG_FUNCTION_ARGS); ++extern "C" PG_FUNCTION_INFO_V1(ST_NewEdgesSplit); + Datum ST_NewEdgesSplit(PG_FUNCTION_ARGS) + { + text* toponame_text; +@@ -3122,7 +3122,7 @@ Datum ST_NewEdgesSplit(PG_FUNCTION_ARGS) + } + + /* ST_AddIsoNode(atopology, aface, apoint) */ +-Datum ST_AddIsoNode(PG_FUNCTION_ARGS); ++extern "C" Datum ST_AddIsoNode(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_AddIsoNode); + Datum ST_AddIsoNode(PG_FUNCTION_ARGS) + { +@@ -3198,7 +3198,7 @@ Datum ST_AddIsoNode(PG_FUNCTION_ARGS) + } + + /* ST_AddIsoEdge(atopology, anode, anothernode, acurve) */ +-Datum ST_AddIsoEdge(PG_FUNCTION_ARGS); ++extern "C" Datum ST_AddIsoEdge(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_AddIsoEdge); + Datum ST_AddIsoEdge(PG_FUNCTION_ARGS) + { +@@ -3271,7 +3271,7 @@ Datum ST_AddIsoEdge(PG_FUNCTION_ARGS) + } + + /* ST_AddEdgeModFace(atopology, snode, enode, line) */ +-Datum ST_AddEdgeModFace(PG_FUNCTION_ARGS); ++extern "C" Datum ST_AddEdgeModFace(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_AddEdgeModFace); + Datum ST_AddEdgeModFace(PG_FUNCTION_ARGS) + { +@@ -3337,7 +3337,7 @@ Datum ST_AddEdgeModFace(PG_FUNCTION_ARGS) + } + + /* ST_AddEdgeNewFaces(atopology, snode, enode, line) */ +-Datum ST_AddEdgeNewFaces(PG_FUNCTION_ARGS); ++extern "C" Datum ST_AddEdgeNewFaces(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_AddEdgeNewFaces); + Datum ST_AddEdgeNewFaces(PG_FUNCTION_ARGS) + { +@@ -3403,7 +3403,7 @@ Datum ST_AddEdgeNewFaces(PG_FUNCTION_ARGS) + } + + /* ST_GetFaceGeometry(atopology, aface) */ +-Datum ST_GetFaceGeometry(PG_FUNCTION_ARGS); ++extern "C" Datum ST_GetFaceGeometry(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_GetFaceGeometry); + Datum ST_GetFaceGeometry(PG_FUNCTION_ARGS) + { +@@ -3470,7 +3470,7 @@ typedef struct FACEEDGESSTATE + FACEEDGESSTATE; + + /* ST_GetFaceEdges(atopology, aface) */ +-Datum ST_GetFaceEdges(PG_FUNCTION_ARGS); ++extern "C" Datum ST_GetFaceEdges(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_GetFaceEdges); + Datum ST_GetFaceEdges(PG_FUNCTION_ARGS) + { +@@ -3596,7 +3596,7 @@ Datum ST_GetFaceEdges(PG_FUNCTION_ARGS) + } + + /* ST_ChangeEdgeGeom(atopology, anedge, acurve) */ +-Datum ST_ChangeEdgeGeom(PG_FUNCTION_ARGS); ++extern "C" Datum ST_ChangeEdgeGeom(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_ChangeEdgeGeom); + Datum ST_ChangeEdgeGeom(PG_FUNCTION_ARGS) + { +@@ -3667,7 +3667,7 @@ Datum ST_ChangeEdgeGeom(PG_FUNCTION_ARGS) + } + + /* ST_RemoveIsoNode(atopology, anode) */ +-Datum ST_RemoveIsoNode(PG_FUNCTION_ARGS); ++extern "C" Datum ST_RemoveIsoNode(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_RemoveIsoNode); + Datum ST_RemoveIsoNode(PG_FUNCTION_ARGS) + { +@@ -3727,7 +3727,7 @@ Datum ST_RemoveIsoNode(PG_FUNCTION_ARGS) + } + + /* ST_RemIsoEdge(atopology, anedge) */ +-Datum ST_RemIsoEdge(PG_FUNCTION_ARGS); ++extern "C" Datum ST_RemIsoEdge(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_RemIsoEdge); + Datum ST_RemIsoEdge(PG_FUNCTION_ARGS) + { +@@ -3787,7 +3787,7 @@ Datum ST_RemIsoEdge(PG_FUNCTION_ARGS) + } + + /* ST_MoveIsoNode(atopology, anode, apoint) */ +-Datum ST_MoveIsoNode(PG_FUNCTION_ARGS); ++extern "C" Datum ST_MoveIsoNode(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_MoveIsoNode); + Datum ST_MoveIsoNode(PG_FUNCTION_ARGS) + { +@@ -3871,7 +3871,7 @@ Datum ST_MoveIsoNode(PG_FUNCTION_ARGS) + } + + /* ST_RemEdgeModFace(atopology, anedge) */ +-Datum ST_RemEdgeModFace(PG_FUNCTION_ARGS); ++extern "C" Datum ST_RemEdgeModFace(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_RemEdgeModFace); + Datum ST_RemEdgeModFace(PG_FUNCTION_ARGS) + { +@@ -3922,7 +3922,7 @@ Datum ST_RemEdgeModFace(PG_FUNCTION_ARGS) + } + + /* ST_RemEdgeNewFace(atopology, anedge) */ +-Datum ST_RemEdgeNewFace(PG_FUNCTION_ARGS); ++extern "C" Datum ST_RemEdgeNewFace(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_RemEdgeNewFace); + Datum ST_RemEdgeNewFace(PG_FUNCTION_ARGS) + { +@@ -3971,7 +3971,7 @@ Datum ST_RemEdgeNewFace(PG_FUNCTION_ARGS) + } + + /* ST_ModEdgeHeal(atopology, anedge, anotheredge) */ +-Datum ST_ModEdgeHeal(PG_FUNCTION_ARGS); ++extern "C" Datum ST_ModEdgeHeal(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_ModEdgeHeal); + Datum ST_ModEdgeHeal(PG_FUNCTION_ARGS) + { +@@ -4021,7 +4021,7 @@ Datum ST_ModEdgeHeal(PG_FUNCTION_ARGS) + } + + /* ST_NewEdgeHeal(atopology, anedge, anotheredge) */ +-Datum ST_NewEdgeHeal(PG_FUNCTION_ARGS); ++extern "C" Datum ST_NewEdgeHeal(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(ST_NewEdgeHeal); + Datum ST_NewEdgeHeal(PG_FUNCTION_ARGS) + { +@@ -4071,7 +4071,7 @@ Datum ST_NewEdgeHeal(PG_FUNCTION_ARGS) + } + + /* GetNodeByPoint(atopology, point, tolerance) */ +-Datum GetNodeByPoint(PG_FUNCTION_ARGS); ++extern "C" Datum GetNodeByPoint(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(GetNodeByPoint); + Datum GetNodeByPoint(PG_FUNCTION_ARGS) + { +@@ -4137,7 +4137,7 @@ Datum GetNodeByPoint(PG_FUNCTION_ARGS) + } + + /* GetEdgeByPoint(atopology, point, tolerance) */ +-Datum GetEdgeByPoint(PG_FUNCTION_ARGS); ++extern "C" Datum GetEdgeByPoint(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(GetEdgeByPoint); + Datum GetEdgeByPoint(PG_FUNCTION_ARGS) + { +@@ -4203,7 +4203,7 @@ Datum GetEdgeByPoint(PG_FUNCTION_ARGS) + } + + /* GetFaceByPoint(atopology, point, tolerance) */ +-Datum GetFaceByPoint(PG_FUNCTION_ARGS); ++extern "C" Datum GetFaceByPoint(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(GetFaceByPoint); + Datum GetFaceByPoint(PG_FUNCTION_ARGS) + { +@@ -4269,7 +4269,7 @@ Datum GetFaceByPoint(PG_FUNCTION_ARGS) + } + + /* TopoGeo_AddPoint(atopology, point, tolerance) */ +-Datum TopoGeo_AddPoint(PG_FUNCTION_ARGS); ++extern "C" Datum TopoGeo_AddPoint(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(TopoGeo_AddPoint); + Datum TopoGeo_AddPoint(PG_FUNCTION_ARGS) + { +@@ -4343,7 +4343,7 @@ Datum TopoGeo_AddPoint(PG_FUNCTION_ARGS) + } + + /* TopoGeo_AddLinestring(atopology, point, tolerance) */ +-Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS); ++extern "C" Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(TopoGeo_AddLinestring); + Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS) + { +@@ -4467,7 +4467,7 @@ Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS) + } + + /* TopoGeo_AddPolygon(atopology, poly, tolerance) */ +-Datum TopoGeo_AddPolygon(PG_FUNCTION_ARGS); ++extern "C" Datum TopoGeo_AddPolygon(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(TopoGeo_AddPolygon); + Datum TopoGeo_AddPolygon(PG_FUNCTION_ARGS) + { +-- +2.6.4.windows.1 + diff --git a/third_party/dependency/postgis/文档指导/PostGIS安装使用指导.docx b/third_party/dependency/postgis/文档指导/PostGIS安装使用指导.docx new file mode 100644 index 000000000..7a805fe38 Binary files /dev/null and b/third_party/dependency/postgis/文档指导/PostGIS安装使用指导.docx differ