!380 【openGauss】add patches for postgis extension
Merge pull request !380 from 宋清怡/master
This commit is contained in:
43
contrib/postgis/Makefile
Normal file
43
contrib/postgis/Makefile
Normal file
@ -0,0 +1,43 @@
|
||||
#
|
||||
# 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.
|
||||
# You may obtain a copy of Mulan PSL v2 at:
|
||||
#
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
# ---------------------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile
|
||||
# Makefile for the postgis
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# contrib/postgis/Makefile
|
||||
#
|
||||
# ---------------------------------------------------------------------------------------
|
||||
|
||||
install:install-data
|
||||
|
||||
top_builddir = ../../
|
||||
POSTGIS_DIR=$(top_builddir)/third_party/dependency/postgis
|
||||
#source code
|
||||
POSTGIS_PACKAGE=postgis-xc
|
||||
|
||||
.PHONY: install-data
|
||||
install-data:
|
||||
@$(call install_postgis)
|
||||
|
||||
uninstall distclean clean:
|
||||
@rm -rf $(POSTGIS_DIR)/$(POSTGIS_PACKAGE)
|
||||
|
||||
define install_postgis
|
||||
cd $(POSTGIS_DIR); \
|
||||
sh install_postgis.sh; \
|
||||
cd - ;
|
||||
endef
|
||||
|
||||
121
third_party/dependency/postgis/README.md
vendored
Normal file
121
third_party/dependency/postgis/README.md
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
## Introduction
|
||||
|
||||
This module contains the implementation patch and installation scripts of shared libraries "Postgis" extension(version PostGIS-2.4.2), which provides spatial objects for the openGauss database, allowing storage and query of information about location and mapping.
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
### NOTICE:
|
||||
|
||||
The installation of postgis extension is highly dependent on the openGauss-third_party_binarylibs, which you could prepare according to https://opengauss.org/zh/docs/1.0.1/docs/Compilationguide/%E7%89%88%E6%9C%AC%E7%BC%96%E8%AF%91.html instruction. Please note that if used the provided libs without build, it is possible to get some errors like "*can not find xxxx.la*", in which case you need to copy the corresponding files to that destination.
|
||||
|
||||
### Prepare:
|
||||
|
||||
Postgis extension is dependent on the following tools (or higher viersion):
|
||||
|
||||
- **GCC-5.4、 zlib、autoconf、automake**
|
||||
|
||||
- Geos 3.6.2
|
||||
|
||||
- Proj 4.9.2
|
||||
|
||||
- Json 0.12.1
|
||||
|
||||
- Libxml2 2.7.1
|
||||
- Gdal 1.11.0
|
||||
|
||||
For their installation, you could freely choose to install them by yourself, and we will only provide the the script for " *Geos、Proj、Json、Libxml、Gdal 1.11.0* " installation, which you could choose to install by script after " ***GCC-5.4、 zlib、autoconf、automake*** " are installed in the environment.
|
||||
|
||||
### Complie and Install by script:
|
||||
|
||||
1. Download source code *postgis-xc-master-2020-09-17.tar.gz* from the website:
|
||||
|
||||
https://opengauss.obs.cn-south-1.myhuaweicloud.com/dependency/postgis-xc-master-2020-09-17.tar.gz
|
||||
|
||||
2. Move it to **third_party/dependency/postgis/** dictionary.
|
||||
|
||||
3. Configure environment variables, add ***__\*** based on the code download location.
|
||||
|
||||
```
|
||||
export CODE_BASE=________ # Path of the openGauss-server file
|
||||
export BINARYLIBS=________ # Path of the binarylibs file
|
||||
export GAUSSHOME=________ # Path of opengauss installation
|
||||
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$GAUSSHOME/pggis_tools/geos/lib:$GAUSSHOME/pggis_tools/proj4/lib:$GAUSSHOME/pggis_tools/gdal/lib:$GAUSSHOME/pggis_tools/libxml2/lib/:$LD_LIBRARY_PATH
|
||||
```
|
||||
|
||||
4. Compile and install postgis:
|
||||
|
||||
```
|
||||
cd $CODE_BASE/contrib/postgis/
|
||||
make insatll -sj
|
||||
```
|
||||
|
||||
5. Pldebugger installation finished.
|
||||
|
||||
### Complie and Install by yourself:
|
||||
|
||||
1. Download source code postgis-xc-master-2020-09-17.tar.gz from the website:
|
||||
|
||||
https://opengauss.obs.cn-south-1.myhuaweicloud.com/dependency/postgis-xc-master-2020-09-17.tar.gz
|
||||
|
||||
2. copy it to *$GAUSSHOME/thirdparty/dependency/postgis/ path, unzip the tar.gz* and rename to **postgis-xc**
|
||||
3. the tools should be installed under the *$GAUSSHOME/pggis_tools* dir :
|
||||
|
||||
```
|
||||
#install geos
|
||||
cd $GAUSSHOME/thirdparty/dependency/postgis/postgis-xc/geos-3.6.2
|
||||
chmod +x ./configure
|
||||
./configure --prefix=$GAUSSHOME/pggis_tools/geos
|
||||
make -sj
|
||||
make install -sj
|
||||
|
||||
#install proj
|
||||
cd $GAUSSHOME/postgis-xc/proj-4.9.2
|
||||
chmod +x ./configure
|
||||
./configure --prefix=$GAUSSHOME/pggis_tools/proj
|
||||
make –sj
|
||||
make install -sj
|
||||
|
||||
#install json
|
||||
cd $GAUSSHOME/postgis-xc/json-c-json-c-0.12.1-20160607
|
||||
chmod +x ./configure
|
||||
./configure --prefix=$GAUSSHOME/pggis_tools/json
|
||||
make -sj
|
||||
make install -sj
|
||||
|
||||
#install libxml2
|
||||
cd $GAUSSHOME/postgis-xc/libxml2-2.7.1
|
||||
chmod +x ./configure
|
||||
./configure --prefix=$GAUSSHOME/pggis_tools/libxml2
|
||||
make -sj
|
||||
make install -sj
|
||||
```
|
||||
|
||||
4. install postgis, remember to add "*--build=aarch64-unknown-linux-gnu*" if your system is **openeuler_aarch64**, and complete the "____" with your system type:
|
||||
|
||||
```
|
||||
export toolhome=$GAUSSHOME/pggis_tools
|
||||
cd $CODE_BASE
|
||||
patch -p1 < thirdparty/dependency/postgis/postgis.patch
|
||||
cd $PGGIS_DIR/postgis-xc/postgis-2.4.2
|
||||
|
||||
#complile
|
||||
./configure --prefix=$toolhome/pggis2.4.2 --with-pgconfig=$GAUSSHOME/bin/pg_config --with-projdir=$toolhome/proj --with-geosconfig=$toolhome/geos/bin/geos-config --with-jsondir=$toolhome/json --with-xml2config=$toolhome/libxml2/bin/xml2-config --with-raster --with-gdalconfig=$toolhome/gdal/bin/gdal-config --with-topology --without-address-standardizer CFLAGS="-fPIC -O2 -fpermissive -DPGXC -pthread -D_THREAD_SAFE -D__STDC_FORMAT_MACROS -DMEMORY_CONTEXT_CHECKING -w -I$CODE_BASE/contrib/postgis/ -I$BINARYLIBS/dependency/____/cjson/comm/include/ -I$BINARYLIBS/dependency/____/openssl/comm/include/ -I$BINARYLIBS/dependency/____/kerberos/comm/include/ -I$BINARYLIBS/dependency/____/libobs/comm/include/" CPPFLAGS="-I$CODE_BASE/contrib/postgis/ -I$BINARYLIBS/dependency/____/cjson/comm/include -I$BINARYLIBS/dependency/____/libobs/comm/include/ -fpermissive -w -DMEMORY_CONTEXT_CHECKING -D__STDC_FORMAT_MACROS" CC=g++ -q
|
||||
|
||||
#install
|
||||
make -sj && make install -sj
|
||||
```
|
||||
|
||||
5. copy the essential files to opengauss install folders:
|
||||
|
||||
```
|
||||
cp $toolhome/json/lib/libjson-c.so.2 $GAUSSHOME/lib/libjson-c.so.2
|
||||
cp $toolhome/geos/lib/libgeos_c.so.1 $GAUSSHOME/lib/libgeos_c.so.1
|
||||
cp $toolhome/proj/lib/libproj.so.9 $GAUSSHOME/lib/libproj.so.9
|
||||
cp $toolhome/geos/lib/libgeos-3.6.2.so $GAUSSHOME/lib/libgeos-3.6.2.so
|
||||
cp $toolhome/pggis2.4.2/lib/liblwgeom-2.4.so.0 $GAUSSHOME/lib/liblwgeom-2.4.so.0
|
||||
cp $PGGIS_DIR/postgis-xc/postgis-2.4.2/postgis.control $GAUSSHOME/share/postgresql/extension/
|
||||
cp $PGGIS_DIR/postgis-xc/postgis-2.4.2/postgis--2.4.2.sql $GAUSSHOME/share/postgresql/extension/
|
||||
```
|
||||
@ -1,139 +0,0 @@
|
||||
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
|
||||
|
||||
186
third_party/dependency/postgis/install_postgis.sh
vendored
Normal file
186
third_party/dependency/postgis/install_postgis.sh
vendored
Normal file
@ -0,0 +1,186 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export toolhome=$GAUSSHOME/pggis_tools
|
||||
export PGGIS_DIR=$CODE_BASE/third_party/dependency/postgis
|
||||
platform=`sh $CODE_BASE/src/get_PlatForm_str.sh`
|
||||
|
||||
#main function of install tools
|
||||
function install_tools()
|
||||
{
|
||||
echo '-----install geos'
|
||||
if [ ! -d "$toolhome/geos" ]; then
|
||||
echo "the geos will be installed under $toolhome/geos"
|
||||
install_geos
|
||||
else
|
||||
read -p "The geos is already installed, remove it and re-install?: [y/n] " answer
|
||||
if [ "$answer" == "y" ]; then
|
||||
install_geos
|
||||
else
|
||||
echo "skip to reinstalled geos"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo '-----install proj'
|
||||
if [ ! -d "$toolhome/proj" ]; then
|
||||
echo "the proj will be installed under $toolhome/proj"
|
||||
install_proj
|
||||
else
|
||||
read -p "The proj is already installed, remove it and re-install?: [y/n] " answer
|
||||
if [ "$answer" == "y" ]; then
|
||||
install_proj
|
||||
else
|
||||
echo "skip to reinstalled proj"
|
||||
fi
|
||||
fi
|
||||
|
||||
#install JSON-C
|
||||
echo '-----install JSON-C'
|
||||
if [ ! -d "$toolhome/json" ]; then
|
||||
echo "the json will be installed under $toolhome/json"
|
||||
install_json
|
||||
else
|
||||
read -p "The json is already installed, remove it and re-install?: [y/n] " answer
|
||||
if [ "$answer" == "y" ]; then
|
||||
install_json
|
||||
else
|
||||
echo "skip to reinstalled json"
|
||||
fi
|
||||
fi
|
||||
|
||||
#install Libxml2
|
||||
echo '-----install Libxml2'
|
||||
if [ ! -d "$toolhome/libxml2" ]; then
|
||||
echo "the libxml2 will be installed under $toolhome/libxml2"
|
||||
install_libxml2
|
||||
else
|
||||
read -p "The libxml2 is already installed, remove it and re-install?: [y/n] " answer
|
||||
if [ "$answer" == "y" ]; then
|
||||
install_libxml2
|
||||
else
|
||||
echo "skip to reinstalled libxml2"
|
||||
fi
|
||||
fi
|
||||
|
||||
#install Gdal
|
||||
echo '-----install Gdal'
|
||||
if [ ! -d "$toolhome/gdal" ]; then
|
||||
echo "the gdal will be installed under $toolhome/gdal"
|
||||
install_gdal
|
||||
else
|
||||
read -p "The gdal is already installed, remove it and re-install?: [y/n] " answer
|
||||
if [ "$answer" == "y" ]; then
|
||||
install_gdal
|
||||
else
|
||||
echo "skip to reinstalled gdal"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function install_proj()
|
||||
{
|
||||
cd $PGGIS_DIR/postgis-xc/proj-4.9.2
|
||||
if [ "$platform" == "openeuler_aarch64" ]; then
|
||||
./configure --build=aarch64-unknown-linux-gnu --prefix=$toolhome/proj -q
|
||||
else
|
||||
./configure --prefix=$toolhome/proj -q
|
||||
fi
|
||||
make -sj && make install -sj
|
||||
}
|
||||
|
||||
function install_libxml2()
|
||||
{
|
||||
cd $PGGIS_DIR/postgis-xc/libxml2-2.7.1
|
||||
chmod +x ./configure
|
||||
if [ "$platform" == "openeuler_aarch64" ]; then
|
||||
./configure --build=aarch64-unknown-linux-gnu --prefix=$toolhome/libxml2 -q
|
||||
else
|
||||
./configure --prefix=$toolhome/libxml2 -q
|
||||
fi
|
||||
make -sj && make install -sj
|
||||
}
|
||||
|
||||
function install_json()
|
||||
{
|
||||
cd $PGGIS_DIR/postgis-xc/json-c-json-c-0.12.1-20160607
|
||||
chmod +x ./configure
|
||||
if [ "$platform" == "openeuler_aarch64" ]; then
|
||||
./configure --build=aarch64-unknown-linux-gnu --prefix=$toolhome/json -q
|
||||
else
|
||||
./configure --prefix=$toolhome/json -q
|
||||
fi
|
||||
make -sj && make install -sj
|
||||
}
|
||||
|
||||
function install_gdal()
|
||||
{
|
||||
cd $PGGIS_DIR/postgis-xc/gdal-1.11.0
|
||||
chmod +x ./configure
|
||||
chmod +x ./install-sh
|
||||
if [ "$platform" == "openeuler_aarch64" ]; then
|
||||
./configure --build=aarch64-unknown-linux-gnu --prefix=$toolhome/gdal --with-xml2=$toolhome/libxml2/bin/xml2-config --with-geos=$toolhome/geos/bin/geos-config --with-static-proj4=$toolhome/proj CFLAGS='-O2 -fpermissive -pthread' -q
|
||||
else
|
||||
./configure --prefix=$toolhome/gdal --with-xml2=$toolhome/libxml2/bin/xml2-config --with-geos=$toolhome/geos/bin/geos-config --with-static-proj4=$toolhome/proj CFLAGS='-O2 -fpermissive -pthread' -q
|
||||
fi
|
||||
make -sj || make -sj
|
||||
make install -sj
|
||||
}
|
||||
|
||||
function install_geos()
|
||||
{
|
||||
cd $PGGIS_DIR/postgis-xc/geos-3.6.2
|
||||
chmod +x ./configure
|
||||
if [ "$platform" == "openeuler_aarch64" ]; then
|
||||
./configure --build=aarch64-unknown-linux-gnu --prefix=$toolhome/geos -q
|
||||
else
|
||||
./configure --prefix=$toolhome/geos -q
|
||||
fi
|
||||
make -sj && make install -sj
|
||||
}
|
||||
|
||||
if [ ! -x $GAUSSHOME -o ! -x $CODE_BASE -o ! -x $BINARYLIBS ];then
|
||||
echo "PATH 'GAUSSHOME' or 'CODE_BASE' or 'BINARYLIBS' does not exist, please check your env variables."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#get source code
|
||||
if [ ! -d "$PGGIS_DIR/postgis-xc" ]; then
|
||||
wget -P $PGGIS_DIR https://opengauss.obs.cn-south-1.myhuaweicloud.com/dependency/postgis-xc-master-2020-09-17.tar.gz
|
||||
if [ ! -x "$PGGIS_DIR/postgis-xc-master-2020-09-17.tar.gz" ]; then
|
||||
echo "no executable postgis-xc-master-2020-09-17.tar.gz file under $PGGIS_DIR"
|
||||
exit 1
|
||||
fi
|
||||
mkdir $PGGIS_DIR/postgis-xc && tar -xzvf $PGGIS_DIR/postgis-xc-master-2020-09-17.tar.gz -C $PGGIS_DIR/postgis-xc --strip-components 1 > /dev/null
|
||||
fi
|
||||
|
||||
#install dependent tools
|
||||
echo "The dependent tools of postgis will be installed under $toolhome"
|
||||
install_tools
|
||||
|
||||
#install postgis
|
||||
echo '-----install PostGIS'
|
||||
cd $CODE_BASE
|
||||
! patch -p1 < $PGGIS_DIR/postgis.patch
|
||||
cd $PGGIS_DIR/postgis-xc/postgis-2.4.2
|
||||
chmod +x ./configure
|
||||
if [ "$platform" == "openeuler_aarch64" ]; then
|
||||
./configure --build=aarch64-unknown-linux-gnu --prefix=$toolhome/pggis2.4.2 --with-pgconfig=$GAUSSHOME/bin/pg_config --with-projdir=$toolhome/proj --with-geosconfig=$toolhome/geos/bin/geos-config --with-jsondir=$toolhome/json --with-xml2config=$toolhome/libxml2/bin/xml2-config --with-raster --with-gdalconfig=$toolhome/gdal/bin/gdal-config --with-topology --without-address-standardizer CFLAGS="-fPIC -O2 -fpermissive -DPGXC -pthread -D_THREAD_SAFE -D__STDC_FORMAT_MACROS -DMEMORY_CONTEXT_CHECKING -w -I$CODE_BASE/contrib/postgis/ -I$BINARYLIBS/dependency/$platform/cjson/comm/include/ -I$BINARYLIBS/dependency/$platform/openssl/comm/include/ -I$BINARYLIBS/dependency/$platform/kerberos/comm/include/ -I$BINARYLIBS/dependency/$platform/libobs/comm/include/" CPPFLAGS="-I$CODE_BASE/contrib/postgis/ -I$BINARYLIBS/dependency/$platform/cjson/comm/include -I$BINARYLIBS/dependency/$platform/libobs/comm/include/ -fpermissive -w -DMEMORY_CONTEXT_CHECKING -D__STDC_FORMAT_MACROS" CC=g++ -q
|
||||
else
|
||||
./configure --prefix=$toolhome/pggis2.4.2 --with-pgconfig=$GAUSSHOME/bin/pg_config --with-projdir=$toolhome/proj --with-geosconfig=$toolhome/geos/bin/geos-config --with-jsondir=$toolhome/json --with-xml2config=$toolhome/libxml2/bin/xml2-config --with-raster --with-gdalconfig=$toolhome/gdal/bin/gdal-config --with-topology --without-address-standardizer CFLAGS="-fPIC -O2 -fpermissive -DPGXC -pthread -D_THREAD_SAFE -D__STDC_FORMAT_MACROS -DMEMORY_CONTEXT_CHECKING -w -I$CODE_BASE/contrib/postgis/ -I$BINARYLIBS/dependency/$platform/cjson/comm/include/ -I$BINARYLIBS/dependency/$platform/openssl/comm/include/ -I$BINARYLIBS/dependency/$platform/kerberos/comm/include/ -I$BINARYLIBS/dependency/$platform/libobs/comm/include/" CPPFLAGS="-I$CODE_BASE/contrib/postgis/ -I$BINARYLIBS/dependency/$platform/cjson/comm/include -I$BINARYLIBS/dependency/$platform/libobs/comm/include/ -fpermissive -w -DMEMORY_CONTEXT_CHECKING -D__STDC_FORMAT_MACROS" CC=g++ -q
|
||||
fi
|
||||
make -sj && make install -sj
|
||||
if [ -x "$toolhome/pggis2.4.2/lib/liblwgeom-2.4.so.0" ]; then
|
||||
echo "PostGIS installed successfully."
|
||||
else
|
||||
echo "PostGIS installation failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#copy the essential files
|
||||
cp $toolhome/json/lib/libjson-c.so.2 $GAUSSHOME/lib/libjson-c.so.2
|
||||
cp $toolhome/geos/lib/libgeos_c.so.1 $GAUSSHOME/lib/libgeos_c.so.1
|
||||
cp $toolhome/proj/lib/libproj.so.9 $GAUSSHOME/lib/libproj.so.9
|
||||
cp $toolhome/geos/lib/libgeos-3.6.2.so $GAUSSHOME/lib/libgeos-3.6.2.so
|
||||
cp $toolhome/pggis2.4.2/lib/liblwgeom-2.4.so.0 $GAUSSHOME/lib/liblwgeom-2.4.so.0
|
||||
cp $PGGIS_DIR/postgis-xc/postgis-2.4.2/postgis.control $GAUSSHOME/share/postgresql/extension/
|
||||
cp $PGGIS_DIR/postgis-xc/postgis-2.4.2/postgis--2.4.2.sql $GAUSSHOME/share/postgresql/extension/
|
||||
echo "Ready to restart database and create related extension!"
|
||||
462
third_party/dependency/postgis/postgis.patch
vendored
462
third_party/dependency/postgis/postgis.patch
vendored
@ -1,17 +1,159 @@
|
||||
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
|
||||
diff --git a/contrib/postgis/extension_dependency.h b/contrib/postgis/extension_dependency.h
|
||||
old mode 100755
|
||||
new mode 100644
|
||||
index 3f0117e..9169ad8
|
||||
--- 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;
|
||||
@@ -589,7 +607,9 @@ extern THR_LOCAL PGDLLIMPORT volatile bool InterruptPending;
|
||||
#define PointerIsValid(pointer) ((const void*)(pointer) != NULL)
|
||||
|
||||
extern int SPI_exec(const char* src, long tcount);
|
||||
+#if 0
|
||||
extern int SPI_connect(CommandDest dest = DestSPI, void (*spiCallbackfn)(void*) = NULL, void* clientData = NULL);
|
||||
+#endif
|
||||
extern int SPI_finish(void);
|
||||
extern int SPI_execute(const char* src, bool read_only, long tcount);
|
||||
extern char* SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber);
|
||||
diff --git a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/configure b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/configure
|
||||
index ea25dd2..8e280bf 100755
|
||||
--- a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/configure
|
||||
+++ b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/configure
|
||||
@@ -13515,7 +13515,7 @@ if test "x$LIBLWGEOM_ONLY" = "xno"; then
|
||||
PGSQL_MINOR_VERSION=0
|
||||
fi
|
||||
|
||||
- POSTGIS_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"
|
||||
+ POSTGIS_PGSQL_VERSION=92
|
||||
|
||||
PGSQL_PKGLIBDIR=`"$PG_CONFIG" --pkglibdir`
|
||||
PGSQL_LIBDIR=`"$PG_CONFIG" --libdir`
|
||||
diff --git a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/postgis--2.4.2.sql b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/postgis--2.4.2.sql
|
||||
index 74a34bf..b48f739 100644
|
||||
--- a/postgis--2.4.2.sql
|
||||
+++ b/postgis--2.4.2.sql
|
||||
--- a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/postgis--2.4.2.sql
|
||||
+++ b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/postgis--2.4.2.sql
|
||||
@@ -1720,7 +1720,7 @@ CREATE TABLE spatial_ref_sys (
|
||||
auth_srid integer,
|
||||
srtext varchar(2048),
|
||||
@ -21,10 +163,53 @@ index 74a34bf..b48f739 100644
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
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
|
||||
diff --git a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/postgis_svn_revision.h b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/postgis_svn_revision.h
|
||||
index 525c0e9..af82288 100644
|
||||
--- a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/postgis_svn_revision.h
|
||||
+++ b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/postgis_svn_revision.h
|
||||
@@ -1 +1 @@
|
||||
-#define POSTGIS_SVN_REVISION "2.1.1"
|
||||
+#define POSTGIS_SVN_REVISION '2.1.1'
|
||||
diff --git a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/postgis_topology.c b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/postgis_topology.c
|
||||
index 5718b88..fc3d1ec 100644
|
||||
--- a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/postgis_topology.c
|
||||
+++ b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/postgis_topology.c
|
||||
@@ -209,7 +209,7 @@ cb_loadTopologyByName(const LWT_BE_DATA* be, const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- topo = palloc(sizeof(LWT_BE_TOPOLOGY));
|
||||
+ topo = (LWT_BE_TOPOLOGY *)palloc(sizeof(LWT_BE_TOPOLOGY));
|
||||
topo->be_data = (LWT_BE_DATA *)be; /* const cast.. */
|
||||
topo->name = pstrdup(name);
|
||||
|
||||
@@ -846,7 +846,7 @@ cb_getEdgeById(const LWT_BE_TOPOLOGY* topo,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
+ edges = (LWT_ISO_EDGE *)palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -904,7 +904,7 @@ cb_getEdgeByNode(const LWT_BE_TOPOLOGY* topo,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
+ edges = (LWT_ISO_EDGE *)palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -934,7 +934,7 @@ cb_getEdgeByFace(const LWT_BE_TOPOLOGY* topo,
|
||||
int nargs = 1;
|
||||
GSERIALIZED *gser = NULL;
|
||||
|
||||
- datum_ids = palloc(sizeof(Datum)*(*numelems));
|
||||
+ datum_ids = (Datum *)palloc(sizeof(Datum)*(*numelems));
|
||||
for (i=0; i<*numelems; ++i) datum_ids[i] = Int32GetDatum(ids[i]);
|
||||
array_ids = construct_array(datum_ids, *numelems, INT4OID, 4, true, 's');
|
||||
|
||||
@@ -965,7 +965,7 @@ cb_getEdgeByFace(const LWT_BE_TOPOLOGY* topo,
|
||||
POSTGIS_DEBUGF(1, "data_changed is %d", topo->be_data->data_changed);
|
||||
|
||||
@ -34,6 +219,69 @@ index 5718b88..717edee 100644
|
||||
pfree(array_ids); /* not needed anymore */
|
||||
if ( gser ) pfree(gser); /* not needed anymore */
|
||||
MemoryContextSwitchTo( oldcontext ); /* switch back */
|
||||
@@ -982,7 +982,7 @@ cb_getEdgeByFace(const LWT_BE_TOPOLOGY* topo,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
+ edges = (LWT_ISO_EDGE *)palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -1034,7 +1034,7 @@ cb_getFacesById(const LWT_BE_TOPOLOGY* topo,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- faces = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
+ faces = (LWT_ISO_FACE *)palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -1097,7 +1097,7 @@ cb_getRingEdges(const LWT_BE_TOPOLOGY* topo,
|
||||
*numelems = -1; return NULL;
|
||||
}
|
||||
|
||||
- edges = palloc( sizeof(LWT_ELEMID) * SPI_processed );
|
||||
+ edges = (LWT_ELEMID *)palloc( sizeof(LWT_ELEMID) * SPI_processed );
|
||||
rowdesc = SPI_tuptable->tupdesc;
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
@@ -1160,7 +1160,7 @@ cb_getNodeById(const LWT_BE_TOPOLOGY* topo,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- nodes = palloc( sizeof(LWT_ISO_NODE) * SPI_processed );
|
||||
+ nodes = (LWT_ISO_NODE *)palloc( sizeof(LWT_ISO_NODE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -1218,7 +1218,7 @@ cb_getNodeByFace(const LWT_BE_TOPOLOGY* topo,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- nodes = palloc( sizeof(LWT_ISO_NODE) * SPI_processed );
|
||||
+ nodes = (LWT_ISO_NODE *)palloc( sizeof(LWT_ISO_NODE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -1301,7 +1301,7 @@ cb_getEdgeWithinDistance2D(const LWT_BE_TOPOLOGY* topo,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
+ edges = (LWT_ISO_EDGE *)palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -1390,7 +1390,7 @@ cb_getNodeWithinDistance2D(const LWT_BE_TOPOLOGY* topo,
|
||||
}
|
||||
else
|
||||
{
|
||||
- nodes = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
+ nodes = (LWT_ISO_NODE *)palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -2557,7 +2557,7 @@ cb_getFaceContainingPoint( const LWT_BE_TOPOLOGY* topo, const LWPOINT* pt )
|
||||
values[0] = PointerGetDatum(pts);
|
||||
argtypes[0] = topo->geometryOID;
|
||||
@ -43,6 +291,33 @@ index 5718b88..717edee 100644
|
||||
MemoryContextSwitchTo( oldcontext ); /* switch back */
|
||||
pfree(pts); /* not needed anymore */
|
||||
if ( spi_result != SPI_OK_SELECT ) {
|
||||
@@ -2722,7 +2722,7 @@ cb_getNodeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- nodes = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
+ nodes = (LWT_ISO_NODE *)palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -2801,7 +2801,7 @@ cb_getEdgeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
+ edges = (LWT_ISO_EDGE *)palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -2878,7 +2878,7 @@ cb_getFaceWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- faces = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
+ faces = (LWT_ISO_FACE *)palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
|
||||
for ( i=0; i<SPI_processed; ++i )
|
||||
{
|
||||
HeapTuple row = SPI_tuptable->vals[i];
|
||||
@@ -2992,7 +2992,7 @@ _PG_fini(void)
|
||||
}
|
||||
|
||||
@ -117,6 +392,24 @@ index 5718b88..717edee 100644
|
||||
PG_FUNCTION_INFO_V1(ST_GetFaceEdges);
|
||||
Datum ST_GetFaceEdges(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -3536,7 +3536,7 @@ Datum ST_GetFaceEdges(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
- state = lwalloc(sizeof(FACEEDGESSTATE));
|
||||
+ state = (FACEEDGESSTATE *)lwalloc(sizeof(FACEEDGESSTATE));
|
||||
state->elems = elems;
|
||||
state->nelems = nelems;
|
||||
state->curr = 0;
|
||||
@@ -3566,7 +3566,7 @@ Datum ST_GetFaceEdges(PG_FUNCTION_ARGS)
|
||||
funcctx = SRF_PERCALL_SETUP();
|
||||
|
||||
/* get state */
|
||||
- state = funcctx->user_fctx;
|
||||
+ state = (FACEEDGESSTATE *)funcctx->user_fctx;
|
||||
|
||||
if ( state->curr == state->nelems )
|
||||
{
|
||||
@@ -3596,7 +3596,7 @@ Datum ST_GetFaceEdges(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
@ -234,6 +527,24 @@ index 5718b88..717edee 100644
|
||||
PG_FUNCTION_INFO_V1(TopoGeo_AddLinestring);
|
||||
Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -4430,7 +4430,7 @@ Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
- state = lwalloc(sizeof(FACEEDGESSTATE));
|
||||
+ state = (FACEEDGESSTATE *)lwalloc(sizeof(FACEEDGESSTATE));
|
||||
state->elems = elems;
|
||||
state->nelems = nelems;
|
||||
state->curr = 0;
|
||||
@@ -4449,7 +4449,7 @@ Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS)
|
||||
funcctx = SRF_PERCALL_SETUP();
|
||||
|
||||
/* get state */
|
||||
- state = funcctx->user_fctx;
|
||||
+ state = (FACEEDGESSTATE *)funcctx->user_fctx;
|
||||
|
||||
if ( state->curr == state->nelems )
|
||||
{
|
||||
@@ -4467,7 +4467,7 @@ Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
@ -243,6 +554,119 @@ index 5718b88..717edee 100644
|
||||
PG_FUNCTION_INFO_V1(TopoGeo_AddPolygon);
|
||||
Datum TopoGeo_AddPolygon(PG_FUNCTION_ARGS)
|
||||
{
|
||||
--
|
||||
2.6.4.windows.1
|
||||
@@ -4554,7 +4554,7 @@ Datum TopoGeo_AddPolygon(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
- state = lwalloc(sizeof(FACEEDGESSTATE));
|
||||
+ state = (FACEEDGESSTATE *)lwalloc(sizeof(FACEEDGESSTATE));
|
||||
state->elems = elems;
|
||||
state->nelems = nelems;
|
||||
state->curr = 0;
|
||||
@@ -4573,7 +4573,7 @@ Datum TopoGeo_AddPolygon(PG_FUNCTION_ARGS)
|
||||
funcctx = SRF_PERCALL_SETUP();
|
||||
|
||||
/* get state */
|
||||
- state = funcctx->user_fctx;
|
||||
+ state = (FACEEDGESSTATE *)funcctx->user_fctx;
|
||||
|
||||
if ( state->curr == state->nelems )
|
||||
{
|
||||
diff --git a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/sql/topogeometry/totopogeom.sql.in b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/sql/topogeometry/totopogeom.sql.in
|
||||
index 8401a8c..7eb8950 100644
|
||||
--- a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/sql/topogeometry/totopogeom.sql.in
|
||||
+++ b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/sql/topogeometry/totopogeom.sql.in
|
||||
@@ -199,7 +199,7 @@ BEGIN
|
||||
'Layer "%" of topology "%" is %, cannot hold a collection feature.',
|
||||
layer_info.layer_id, topology_info.name, layer_info.typename;
|
||||
END IF;
|
||||
- tg.type := 4;
|
||||
+ tg.type_geo := 4;
|
||||
ELSIF typ = 'POINT' OR typ = 'MULTIPOINT' THEN -- puntal
|
||||
-- A point can go in puntal or collection layer
|
||||
IF layer_info.feature_type != 4 and layer_info.feature_type != 1 THEN
|
||||
@@ -207,7 +207,7 @@ BEGIN
|
||||
'Layer "%" of topology "%" is %, cannot hold a puntal feature.',
|
||||
layer_info.layer_id, topology_info.name, layer_info.typename;
|
||||
END IF;
|
||||
- tg.type := 1;
|
||||
+ tg.type_geo := 1;
|
||||
ELSIF typ = 'LINESTRING' or typ = 'MULTILINESTRING' THEN -- lineal
|
||||
-- A line can go in lineal or collection layer
|
||||
IF layer_info.feature_type != 4 and layer_info.feature_type != 2 THEN
|
||||
@@ -215,7 +215,7 @@ BEGIN
|
||||
'Layer "%" of topology "%" is %, cannot hold a lineal feature.',
|
||||
layer_info.layer_id, topology_info.name, layer_info.typename;
|
||||
END IF;
|
||||
- tg.type := 2;
|
||||
+ tg.type_geo := 2;
|
||||
ELSIF typ = 'POLYGON' OR typ = 'MULTIPOLYGON' THEN -- areal
|
||||
-- An area can go in areal or collection layer
|
||||
IF layer_info.feature_type != 4 and layer_info.feature_type != 3 THEN
|
||||
@@ -223,7 +223,7 @@ BEGIN
|
||||
'Layer "%" of topology "%" is %, cannot hold an areal feature.',
|
||||
layer_info.layer_id, topology_info.name, layer_info.typename;
|
||||
END IF;
|
||||
- tg.type := 3;
|
||||
+ tg.type_geo := 3;
|
||||
ELSE
|
||||
-- Should never happen
|
||||
RAISE EXCEPTION
|
||||
diff --git a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/sql/topogeometry/type.sql.in b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/sql/topogeometry/type.sql.in
|
||||
index 5db267a..01bd092 100644
|
||||
--- a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/sql/topogeometry/type.sql.in
|
||||
+++ b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/sql/topogeometry/type.sql.in
|
||||
@@ -24,10 +24,10 @@ CREATE OR REPLACE FUNCTION topology.GeometryType(tg topology.TopoGeometry)
|
||||
AS
|
||||
$$
|
||||
SELECT CASE
|
||||
- WHEN type($1) = 1 THEN 'MULTIPOINT'
|
||||
- WHEN type($1) = 2 THEN 'MULTILINESTRING'
|
||||
- WHEN type($1) = 3 THEN 'MULTIPOLYGON'
|
||||
- WHEN type($1) = 4 THEN 'GEOMETRYCOLLECTION'
|
||||
+ WHEN type_geo($1) = 1 THEN 'MULTIPOINT'
|
||||
+ WHEN type_geo($1) = 2 THEN 'MULTILINESTRING'
|
||||
+ WHEN type_geo($1) = 3 THEN 'MULTIPOLYGON'
|
||||
+ WHEN type_geo($1) = 4 THEN 'GEOMETRYCOLLECTION'
|
||||
ELSE 'UNEXPECTED'
|
||||
END;
|
||||
$$
|
||||
@@ -48,10 +48,10 @@ CREATE OR REPLACE FUNCTION topology.ST_GeometryType(tg topology.TopoGeometry)
|
||||
AS
|
||||
$$
|
||||
SELECT CASE
|
||||
- WHEN type($1) = 1 THEN 'ST_MultiPoint'
|
||||
- WHEN type($1) = 2 THEN 'ST_MultiLinestring'
|
||||
- WHEN type($1) = 3 THEN 'ST_MultiPolygon'
|
||||
- WHEN type($1) = 4 THEN 'ST_GeometryCollection'
|
||||
+ WHEN type_geo($1) = 1 THEN 'ST_MultiPoint'
|
||||
+ WHEN type_geo($1) = 2 THEN 'ST_MultiLinestring'
|
||||
+ WHEN type_geo($1) = 3 THEN 'ST_MultiPolygon'
|
||||
+ WHEN type_geo($1) = 4 THEN 'ST_GeometryCollection'
|
||||
ELSE 'ST_Unexpected'
|
||||
END;
|
||||
$$
|
||||
diff --git a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/topology.sql.in b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/topology.sql.in
|
||||
index 5eb1148..5562663 100644
|
||||
--- a/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/topology.sql.in
|
||||
+++ b/third_party/dependency/postgis/postgis-xc/postgis-2.4.2/topology/topology.sql.in
|
||||
@@ -340,7 +340,7 @@ CREATE TYPE topology.TopoGeometry AS (
|
||||
topology_id integer,
|
||||
layer_id integer,
|
||||
id integer,
|
||||
- type integer -- 1: [multi]point, 2: [multi]line,
|
||||
+ type_geo integer -- 1: [multi]point, 2: [multi]line,
|
||||
-- 3: [multi]polygon, 4: collection
|
||||
);
|
||||
|
||||
@@ -943,7 +943,7 @@ BEGIN
|
||||
|
||||
-- Set layer id and type in return object
|
||||
ret.layer_id = layer_id;
|
||||
- ret.type = tg_type;
|
||||
+ ret.type_geo = tg_type;
|
||||
|
||||
--
|
||||
-- Get new TopoGeo id from sequence
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user