Skip to content

Commit 3750f66

Browse files
authored
Merge branch 'pgspider:master' into draft_rpm_spec
2 parents 2e07570 + ea52a24 commit 3750f66

File tree

174 files changed

+35761
-8837
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+35761
-8837
lines changed

.github/workflows/CI.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ jobs:
2424
test:
2525
needs: detect-pgversion
2626
env:
27-
SQLITE_VERSION : "3460000"
28-
SQLITE_YEAR: "2024"
27+
SQLITE_VERSION : "3490000"
28+
SQLITE_YEAR: "2025"
2929
POSTGIS_VERSION : "3.4.2"
3030
HTTP_PROXY: ""
3131
HTTPS_PROXY: ""
32+
SQLITE_FOR_TESTING_DIR: "/opt/CI_sqlite"
3233
strategy:
3334
fail-fast: false
3435
matrix:
@@ -46,32 +47,38 @@ jobs:
4647
- name: set_proxy
4748
run: bash GitHubActions/env.sh
4849

50+
- name: download PostGIS, ${{ matrix.config }} mode
51+
run: |
52+
if [[ "${{ matrix.config }}" == "postgis" ]]; then
53+
bash GitHubActions/download_postgis.sh ${{ env.POSTGIS_VERSION }}
54+
fi
55+
4956
- name: install locales
5057
run: bash GitHubActions/install_locales.sh
5158

52-
- name: build PostgreSQL ${{ matrix.pg }} with ${{ matrix.config }}
59+
- name: build PostgreSQL ${{ matrix.pg }}
5360
run: bash GitHubActions/build_postgres.sh ${{ matrix.pg }}
5461

55-
- name: build PostGIS ${{ env.POSTGIS_VERSION }} for PostgreSQL ${{ matrix.pg }}, ${{ matrix.config }} mode
56-
run: |
57-
if [[ "${{ matrix.config }}" == "postgis" ]]; then
58-
bash GitHubActions/build_postgis.sh ${{ matrix.pg }} ${{ env.POSTGIS_VERSION }}
59-
fi
60-
6162
- name: install SQLite, ${{ matrix.config }} mode
6263
run: |
6364
if [[ "${{ matrix.config }}" == "default" ]]; then
64-
bash GitHubActions/install_sqlite.sh ${{ env.SQLITE_VERSION }} ${{ env.SQLITE_YEAR }} "${{ matrix.config }}"
65+
bash GitHubActions/install_sqlite.sh ${{ env.SQLITE_VERSION }} ${{ env.SQLITE_YEAR }} ${{ matrix.config }} ${{ env.SQLITE_FOR_TESTING_DIR }}
6566
elif [[ "${{ matrix.config }}" == "postgis" ]]; then
66-
bash GitHubActions/install_sqlite.sh ${{ env.SQLITE_VERSION }} ${{ env.SQLITE_YEAR }} "${{ matrix.config }}" --enable-rtree
67+
bash GitHubActions/install_sqlite.sh ${{ env.SQLITE_VERSION }} ${{ env.SQLITE_YEAR }} ${{ matrix.config }} ${{ env.SQLITE_FOR_TESTING_DIR }} --enable-rtree
68+
fi
69+
70+
- name: build PostGIS ${{ env.POSTGIS_VERSION }} for PostgreSQL ${{ matrix.pg }}, ${{ matrix.config }} mode
71+
run: |
72+
if [[ "${{ matrix.config }}" == "postgis" ]]; then
73+
bash GitHubActions/build_postgis.sh ${{ matrix.pg }} ${{ env.POSTGIS_VERSION }}
6774
fi
6875
6976
- name: build sqlite_fdw, ${{ matrix.config }} mode
7077
run: |
71-
bash GitHubActions/build_sqlite_fdw.sh ${{ matrix.pg }} ${{ matrix.config }}
78+
bash GitHubActions/build_sqlite_fdw.sh ${{ matrix.pg }} ${{ matrix.config }} ${{ env.SQLITE_FOR_TESTING_DIR }}
7279
7380
- name: execute sqlite_fdw test
74-
run: bash GitHubActions/execute_test.sh ${{ matrix.pg }} ${{ matrix.config }}
81+
run: bash GitHubActions/execute_test.sh ${{ matrix.pg }} ${{ matrix.config }} ${{ env.SQLITE_FOR_TESTING_DIR }}
7582

7683
- name: download output files (regression.diffs)
7784
if: failure()
@@ -83,3 +90,4 @@ jobs:
8390
workdir/postgresql-${{ matrix.pg }}/contrib/sqlite_fdw/regression.out
8491
workdir/postgresql-${{ matrix.pg }}/contrib/sqlite_fdw/results
8592
retention-days: 7
93+

GitHubActions/build_postgis.sh

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
################################################################################
44
#
5-
# This script downloads PostgreSQL from the official web site into ./workdir
5+
# This script downloads PostGIS from the official web site into ./workdir
66
# then builds it.
77
#
88
# Usage: ./build_postgis.sh pg_version postgis_version
@@ -17,23 +17,18 @@
1717
POSTGRESQL_VERSION=$1
1818
POSTGIS_VERSION=$2
1919

20-
cd ./workdir
21-
cd postgresql-${POSTGRESQL_VERSION}
22-
2320
# Install necessary dependencies
2421
sudo apt update
2522
sudo apt install -y build-essential libxml2-dev libgeos-dev libproj-dev libgdal-dev libjson-c-dev libprotobuf-c-dev protobuf-c-compiler
2623

27-
GEOS_CONFIG_PATH=$(which geos-config)
28-
24+
cd ./workdir
2925
# Download and compile PostGIS
30-
cd contrib
31-
wget http://download.osgeo.org/postgis/source/postgis-${POSTGIS_VERSION}.tar.gz
32-
tar -xzf postgis-${POSTGIS_VERSION}.tar.gz
33-
mv postgis-${POSTGIS_VERSION} postgis -v
34-
cd postgis
26+
cp -vr postgis postgresql-${POSTGRESQL_VERSION}/contrib
27+
cd postgresql-${POSTGRESQL_VERSION}/contrib/postgis
3528
echo " - PostGIS directory"
29+
GEOS_CONFIG_PATH=$(which geos-config)
3630
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
3731
./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-geosconfig=$GEOS_CONFIG_PATH
3832
make
3933
sudo make install
34+

GitHubActions/build_sqlite_fdw.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
#
55
# This script builds sqlite_fdw in PostgreSQL source tree.
66
#
7-
# Usage: ./build_sqlite_fdw.sh pg_version mode
7+
# Usage: ./build_sqlite_fdw.sh pg_version mode sqlite_for_testing_dir
88
# pg_version is a PostgreSQL version like 17.0 to be built in.
99
# mode is flag for sqlite_fdw compiler.
10+
# sqlite_for_testing_dir: path to install directory of SQLite version for testing
1011
#
1112
# Requirements
1213
# - the source code of sqlite_fdw is available by git clone.
@@ -18,14 +19,16 @@ VERSION="$1"
1819
MODE="$2"
1920

2021
mkdir -p ./workdir/postgresql-${VERSION}/contrib/sqlite_fdw
21-
tar zxvf ./sqlite_fdw.tar.gz -C ./workdir/postgresql-${VERSION}/contrib/sqlite_fdw/
22+
tar zxf ./sqlite_fdw.tar.gz -C ./workdir/postgresql-${VERSION}/contrib/sqlite_fdw/
2223
cd ./workdir/postgresql-${VERSION}/contrib/sqlite_fdw
23-
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
24+
25+
# show locally compiled sqlite library
26+
ls -la /usr/local/lib
2427

2528
if [ "$MODE" == "postgis" ]; then
26-
make ENABLE_GIS=1
29+
make ENABLE_GIS=1 SQLITE_FOR_TESTING_DIR="$3"
2730
else
28-
make
31+
make SQLITE_FOR_TESTING_DIR="$3"
2932
fi
3033

3134
sudo make install

GitHubActions/download_postgis.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
################################################################################
4+
#
5+
# This script downloads PostGIS from the official web site into ./workdir
6+
# then builds it.
7+
#
8+
# Usage: ./download_postgis.sh postgis_version
9+
# postgis_version is a PostGIS version to be installed.
10+
#
11+
# Requirements
12+
# - be able to connect to the PostGIS official web site by wget.
13+
#
14+
################################################################################
15+
16+
POSTGIS_VERSION=$1
17+
18+
mkdir -p ./workdir
19+
cd ./workdir
20+
pgisfile="postgis-${POSTGIS_VERSION}.tar.gz"
21+
if [ ! -f "$pgisfile" ]; then
22+
wget -nv "http://download.osgeo.org/postgis/source/$pgisfile"
23+
tar -xzf "$pgisfile"
24+
mv postgis-${POSTGIS_VERSION} postgis -v
25+
echo "PostGIS source code directory " $(dirname $(readlink -f postgis))
26+
else
27+
echo "PostGIS downloaded"
28+
fi

GitHubActions/execute_test.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
# sqlite_fdw. If all tests are passed, this script will exit successfully.
77
# Otherwise, it will exit with failure.
88

9-
# Usage: ./execute_test.sh pg_version mode
9+
# Usage: ./execute_test.sh pg_version mode sqlite_for_testing_dir
1010
# pg_version is a PostgreSQL version to be tested like 17.0.
1111
# mode is flag for sqlite_fdw compiler.
12+
# sqlite_for_testing_dir: path to install directory of SQLite version for testing
1213
#
1314
# Requiremets
1415
# - the source code of PostgreSQL is located in ./workdir/postgresql-{pg_version}.
@@ -22,6 +23,7 @@
2223

2324
VERSION=$1
2425
MODE="$2"
26+
SQLITE_FOR_TESTING_DIR="$3"
2527

2628
cd ./workdir/postgresql-${VERSION}/contrib/sqlite_fdw
2729

GitHubActions/install_locales.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ sudo apt-get install locales language-pack-ja
1717
sudo locale-gen ja_JP.EUC-JP
1818
sudo apt-get install language-pack-ko-base language-pack-ko
1919
sudo locale-gen ko_KR.EUC-KR
20-
sudo apt -get install language-pack-bg-base language-pack-bg
20+
sudo apt-get install language-pack-bg-base language-pack-bg
2121
sudo locale-gen bg_BG
22+
sudo apt-get install libreadline8 libreadline-dev

GitHubActions/install_sqlite.sh

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
# This sript downloads SQLite source code from the official web site into
66
# ./workdir then builds and installs it.
77
#
8-
# Usage: ./install_sqlite.sh version year testing_mode [configure_options]
8+
# Usage: ./install_sqlite.sh version year testing_mode sqlite_for_testing_dir [configure_options]
99
# version: SQLite version to be installed.
1010
# year: A year of SQLite released. It is used for determining a download URL.
1111
# testing_mode: 'default' or 'postgis' value.
12+
# sqlite_for_testing_dir: path to install directory of the specified SQLite version
1213
# configure_options: are a list of option for sqlite server.
1314
#
14-
# Ex) ./install_sqlite.sh 3420000 2023 postgis --enable-rtree
15+
# Ex) ./install_sqlite.sh 3420000 2023 postgis /opt/sqlite_for_testing --enable-rtree
1516
#
1617
# Requirements
1718
# - be able to connect to the SQLite official web site by curl.
@@ -22,27 +23,36 @@
2223
VERSION="$1"
2324
YEAR="$2"
2425
TESTING_MODE="$3"
26+
SQLITE_FOR_TESTING_DIR="$4"
2527

2628
CONFIGURE_OPTIONS=""
2729

2830
while (( "$#" )); do
29-
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS $4"
31+
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS $5"
3032
shift
3133
done
3234

35+
echo "SQLite ver $VERSION ($YEAR), mode $TESTING_MODE, install to $SQLITE_FOR_TESTING_DIR with options $CONFIGURE_OPTIONS";
36+
3337
mkdir -p ./workdir
3438
cd ./workdir
35-
curl -O https://www.sqlite.org/${YEAR}/sqlite-src-${VERSION}.zip
36-
unzip sqlite-src-${VERSION}.zip > /dev/null
37-
cd sqlite-src-${VERSION}
38-
39-
if [ -z "$CONFIGURE_OPTIONS" ]; then
40-
./configure --enable-fts5
41-
else
42-
./configure --enable-fts5 $CONFIGURE_OPTIONS
39+
vsrc="sqlite-src-${VERSION}"
40+
adr="https://www.sqlite.org/${YEAR}/$vsrc.zip"
41+
echo "SQLite source code archive: $adr"
42+
wget "$adr" -O "$vsrc.zip"
43+
unzip "$vsrc.zip" > /dev/null
44+
cd "$vsrc"
45+
46+
export CFLAGS=-DSQLITE_ENABLE_COLUMN_METADATA
47+
confcom="./configure --enable-fts5 --prefix=$SQLITE_FOR_TESTING_DIR"
48+
if [ ! -z "$CONFIGURE_OPTIONS" ]; then
49+
confcom+="$CONFIGURE_OPTIONS"
4350
fi
51+
echo "SQLite configure call: $confcom"
52+
$confcom
4453

4554
make
55+
echo "----- SQLITE INSTALL directory $SQLITE_FOR_TESTING_DIR -----"
4656
sudo make install
4757

4858
if [ "$TESTING_MODE" == "postgis" ]; then

Makefile

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,29 @@ EXTENSION = sqlite_fdw
1616
DATA = sqlite_fdw--1.0.sql sqlite_fdw--1.0--1.1.sql
1717

1818
ifdef ENABLE_GIS
19-
override PG_CFLAGS += -DSQLITE_FDW_GIS_ENABLE
20-
GISTEST=postgis
19+
PG_CFLAGS += -DSQLITE_FDW_GIS_ENABLE
20+
GIS_DEP_TESTS_DIR = with_gis_support
21+
GIS_TEST = postgis
22+
$(info There is PostGIS support for SQLite FDW)
2123
else
22-
GISTEST=nogis
24+
GIS_DEP_TESTS_DIR = without_gis_support
25+
GIS_TEST = nogis
26+
$(info There is NO PostGIS support for SQLite FDW)
2327
endif
2428

29+
# Tests for PostgreSQL data types support
30+
DATA_TYPE_TESTS = types/bitstring types/bool types/float4 types/float8 types/int4 types/int8 types/json types/numeric types/macaddr types/macaddr8 types/out_of_range types/timestamp types/uuid
31+
# Tests with different versions with GIS support and without GIS support
32+
GIS_DEP_TESTS = $(GIS_DEP_TESTS_DIR)/type $(GIS_DEP_TESTS_DIR)/auto_import $(GIS_DEP_TESTS_DIR)/$(GIS_TEST)
33+
2534
ifndef REGRESS
26-
REGRESS = extra/sqlite_fdw_post types/bitstring types/bool types/float4 types/float8 types/int4 types/int8 types/numeric types/$(GISTEST) types/macaddr types/macaddr8 types/out_of_range types/timestamp types/uuid extra/join extra/limit extra/aggregates extra/prepare extra/select_having extra/select extra/insert extra/update extra/encodings sqlite_fdw type_$(GISTEST) aggregate selectfunc
35+
# System tests, full default sequence
36+
REGRESS = libsqlite extra/sqlite_fdw_post $(DATA_TYPE_TESTS) extra/join extra/limit extra/aggregates extra/prepare extra/select_having extra/select extra/insert extra/update extra/encodings sqlite_fdw aggregate selectfunc $(GIS_DEP_TESTS)
2737
endif
2838

39+
# Other encodings also are tested. Client encoding should be UTF-8.
2940
REGRESS_OPTS = --encoding=utf8
3041

31-
SQLITE_LIB = sqlite3
32-
3342
UNAME = uname
3443
OS := $(shell $(UNAME))
3544
ifeq ($(OS), Darwin)
@@ -38,7 +47,12 @@ else
3847
DLSUFFIX = .so
3948
endif
4049

50+
ifdef SQLITE_FOR_TESTING_DIR
51+
SHLIB_LINK := -L$(SQLITE_FOR_TESTING_DIR)/lib -lsqlite3
52+
PG_CFLAGS += -I$(SQLITE_FOR_TESTING_DIR)/include -Wl,-rpath,$(SQLITE_FOR_TESTING_DIR)/lib
53+
else
4154
SHLIB_LINK := -lsqlite3
55+
endif
4256

4357
ifdef ENABLE_GIS
4458
override SHLIB_LINK += -lspatialite
@@ -70,9 +84,19 @@ endif
7084
REGRESS := $(addprefix $(REGRESS_PREFIX_SUB)/,$(REGRESS))
7185
$(shell mkdir -p results/$(REGRESS_PREFIX_SUB)/extra)
7286
$(shell mkdir -p results/$(REGRESS_PREFIX_SUB)/types)
87+
$(shell mkdir -p results/$(REGRESS_PREFIX_SUB)/$(GIS_DEP_TESTS_DIR))
88+
89+
# $(info ENABLE_GIS is $(ENABLE_GIS))
90+
# $(info SHLIB_LINK is $(SHLIB_LINK))
91+
# $(info LD_LIBRARY_PATH is $(LD_LIBRARY_PATH))
92+
# $(info PG_CFLAGS is $(PG_CFLAGS))
93+
# $(info PG_CPPFLAGS is $(PG_CPPFLAGS))
94+
# $(info REGRESS is $(REGRESS))
95+
# $(info DLSUFFIX is $(DLSUFFIX))
7396

7497
ifdef ENABLE_GIS
7598
check: temp-install
7699
temp-install: EXTRA_INSTALL+=contrib/postgis
77100
checkprep: EXTRA_INSTALL+=contrib/postgis
78101
endif
102+

0 commit comments

Comments
 (0)