[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha2-79-g520af0e
git at osgeo.org
git at osgeo.org
Mon Oct 5 12:51:06 PDT 2020
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, master has been updated
via 520af0e8d1bb6e9544d974713bb87e428ff4230b (commit)
from d575a6e738ef567b05d80096f41c383e264bd8dc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 520af0e8d1bb6e9544d974713bb87e428ff4230b
Author: Sandro Santilli <strk at kbt.io>
Date: Thu Feb 27 09:42:05 2020 +0100
Work around PG13 drop of `FROM unpackaged` syntax
- Always install empty extension--unpackage.sql scripts
- Have run_test.pl use create/update trick for PG13
- Re-enable check_all_upgrades.sh testing of unpackaged
- Have postgis_extensions_upgrade use the unpackaged trick
Fixes #4643
diff --git a/extensions/postgis/Makefile.in b/extensions/postgis/Makefile.in
index ef7a451..91b3fd8 100644
--- a/extensions/postgis/Makefile.in
+++ b/extensions/postgis/Makefile.in
@@ -32,6 +32,7 @@ PREREL_PREFIX = $(shell echo $(EXTVERSION) | \
DATA_built = \
$(EXTENSION).control \
sql/$(EXTENSION)--$(EXTVERSION).sql \
+ sql/$(EXTENSION)--unpackaged.sql \
sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql \
$(NULL)
@@ -102,6 +103,9 @@ sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION_UNPACKAGED_UPGRADE_
| $(PERL) ../../utils/create_unpackaged.pl postgis \
>> $@
+sql/$(EXTENSION)--unpackaged.sql: Makefile | sql
+ echo "-- Nothing to do here" > $@
+
sql:
mkdir -p $@
diff --git a/extensions/postgis_raster/Makefile.in b/extensions/postgis_raster/Makefile.in
index 856c956..cf9f182 100644
--- a/extensions/postgis_raster/Makefile.in
+++ b/extensions/postgis_raster/Makefile.in
@@ -32,6 +32,7 @@ PREREL_PREFIX = $(shell echo $(EXTVERSION) | \
DATA_built = \
$(EXTENSION).control \
sql/$(EXTENSION)--$(EXTVERSION).sql \
+ sql/$(EXTENSION)--unpackaged.sql \
sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql \
$(NULL)
@@ -74,6 +75,9 @@ sql/$(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION_SCRIPTS) | sql
printf '\\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \\quit\n' > $@
cat $^ >> $@
+sql/$(EXTENSION)--unpackaged.sql: Makefile | sql
+ echo "-- Nothing to do here" > $@
+
sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) ../../utils/create_unpackaged.pl sql/$(EXTENSION)--ANY--$(EXTVERSION).sql Makefile | sql
# Ensure version is correct
cat sql/$(EXTENSION)--ANY--$(EXTVERSION).sql > $@
diff --git a/extensions/postgis_sfcgal/Makefile.in b/extensions/postgis_sfcgal/Makefile.in
index dd7ca48..b3c0019 100644
--- a/extensions/postgis_sfcgal/Makefile.in
+++ b/extensions/postgis_sfcgal/Makefile.in
@@ -25,6 +25,7 @@ PREREL_PREFIX = $(shell echo $(EXTVERSION) | \
DATA_built = \
$(EXTENSION).control \
sql/$(EXTENSION)--$(EXTVERSION).sql \
+ sql/$(EXTENSION)--unpackaged.sql \
sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql \
$(NULL)
@@ -73,6 +74,9 @@ sql_bits/sfcgal_comments.sql: ../../doc/sfcgal_comments.sql
mkdir -p sql_bits
cp $< $@
+sql/$(EXTENSION)--unpackaged.sql: Makefile | sql
+ echo "-- Nothing to do here" > $@
+
#grep all lines that start with CREATE OR REPLACE FUNCTION, TRIGGER...
#then replace CREATE OR REPLACE .. with ALTER EXTENSION..;
#then remove default values and extra junk
diff --git a/extensions/postgis_topology/Makefile.in b/extensions/postgis_topology/Makefile.in
index 38e5128..63e88f4 100644
--- a/extensions/postgis_topology/Makefile.in
+++ b/extensions/postgis_topology/Makefile.in
@@ -34,6 +34,7 @@ PREREL_PREFIX = $(shell echo $(EXTVERSION) | \
DATA_built = \
$(EXTENSION).control \
sql/$(EXTENSION)--$(EXTVERSION).sql \
+ sql/$(EXTENSION)--unpackaged.sql \
sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql \
$(NULL)
@@ -78,6 +79,9 @@ sql_bits/topology.sql: ../../topology/topology.sql
sql_bits/topology_comments.sql: ../../doc/topology_comments.sql
cp $< $@
+sql/$(EXTENSION)--unpackaged.sql: Makefile | sql
+ echo "-- Nothing to do here" > $@
+
sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: ../../topology/topology.sql ../../utils/create_unpackaged.pl sql/topology_upgrade.sql Makefile | sql
# Ugprade before packaging
cat sql/topology_upgrade.sql > $@
diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in
index 9b19f05..e7ea8a5 100644
--- a/postgis/postgis.sql.in
+++ b/postgis/postgis.sql.in
@@ -2927,12 +2927,22 @@ BEGIN
JOIN pg_catalog.pg_namespace n ON (c.relnamespace = n.oid )
WHERE n.nspname = 'tiger' AND c.relname = 'geocode_settings') )
THEN
- --force install in same schema as postgis only if postgis extension is installed
- IF rec.name NOT IN('postgis', 'postgis_topology', 'postgis_tiger_geocoder') AND EXISTS (SELECT 1 FROM pg_catalog.pg_extension WHERE extname = 'postgis') THEN
- sql = 'CREATE EXTENSION ' || rec.name || ' FROM unpackaged SCHEMA '
- || quote_ident( (SELECT ns.nspname FROM pg_catalog.pg_extension AS e INNER JOIN pg_catalog.pg_namespace AS ns ON e.extnamespace = ns.oid WHERE extname = 'postgis')) || ';';
+ -- Force install in same schema as postgis
+ SELECT INTO var_schema n.nspname
+ FROM pg_namespace n, pg_proc p
+ WHERE p.proname = 'postgis_full_version'
+ AND n.oid = p.pronamespace
+ LIMIT 1;
+ IF rec.name NOT IN('postgis_topology', 'postgis_tiger_geocoder')
+ sql := format(
+ 'CREATE EXTENSION %1$I SCHEMA %2$I VERSION unpackaged;'
+ 'ALTER EXTENSION %1%I UPDATE TO %3$I',
+ rec.name, install_schema, rec.default_version);
ELSE
- sql = 'CREATE EXTENSION ' || rec.name || ' FROM unpackaged;';
+ sql := format(
+ 'CREATE EXTENSION %1$I VERSION unpackaged;'
+ 'ALTER EXTENSION %1%I UPDATE TO %2$I',
+ rec.name, rec.default_version);
END IF;
RAISE NOTICE 'Packaging extension %', rec.name;
RAISE DEBUG '%', sql;
diff --git a/regress/run_test.pl b/regress/run_test.pl
index 2fb74e3..7e4751e 100755
--- a/regress/run_test.pl
+++ b/regress/run_test.pl
@@ -431,6 +431,7 @@ my $geosver = sql("select postgis_geos_version()");
my $projver = sql("select postgis_proj_version()");
my $libbuilddate = sql("select postgis_lib_build_date()");
my $pgsqlver = sql("select version()");
+my $pgsqlvernum = sql("select current_setting('server_version_num')");
my $gdalver = sql("select postgis_gdal_version()") if $OPT_WITH_RASTER;
my $sfcgalver = sql("select postgis_sfcgal_version()") if $OPT_WITH_SFCGAL;
my $scriptver = sql("select postgis_scripts_installed()");
@@ -1525,6 +1526,20 @@ sub prepare_spatial
return 1;
}
+sub package_extension_sql
+{
+ my ($extname, $extver) = @_;
+ my $sql;
+
+ if ( $pgsqlvernum lt 130000 ) {
+ $sql = "CREATE EXTENSION ${extname} VERSION '${extver}' FROM unpackaged;";
+ } else {
+ $sql = "CREATE EXTENSION ${extname} VERSION unpackaged;";
+ $sql .= "ALTER EXTENSION ${extname} UPDATE TO '${extver}'";
+ }
+ return $sql;
+}
+
# Upgrade an existing database (soft upgrade)
sub upgrade_spatial
{
@@ -1629,7 +1644,7 @@ sub upgrade_spatial_extensions
}
elsif ( $OPT_UPGRADE_FROM =~ /^unpackaged/ )
{
- $sql = "CREATE EXTENSION postgis VERSION '${nextver}' FROM unpackaged";
+ $sql = package_extension_sql('postgis', ${nextver});
}
else
{
@@ -1642,7 +1657,7 @@ sub upgrade_spatial_extensions
#print "CMD: " . $cmd . "\n";
my $rv = system($cmd);
if ( $rv ) {
- fail "Error encountered altering EXTENSION POSTGIS", $REGRESS_LOG;
+ fail "Error encountered updating EXTENSION POSTGIS", $REGRESS_LOG;
die;
}
@@ -1655,7 +1670,7 @@ sub upgrade_spatial_extensions
{
# upgrade of postgis must have unpackaged raster, so
# we create it again here
- my $sql = "CREATE EXTENSION postgis_raster VERSION '${nextver}' FROM unpackaged";
+ my $sql = package_extension_sql('postgis_raster', ${nextver});
print "Upgrading PostGIS Raster in '${DB}' using: ${sql}\n" ;
@@ -1672,7 +1687,8 @@ sub upgrade_spatial_extensions
# left unpackaged
print "Packaging PostGIS Raster in '${DB}' for later drop using: ${sql}\n" ;
- $sql = "CREATE EXTENSION postgis_raster VERSION '${nextver}' FROM unpackaged";
+ $sql = package_extension_sql('postgis_raster', ${nextver});
+
$cmd = "psql $psql_opts -c \"" . $sql . "\" $DB >> $REGRESS_LOG 2>&1";
$rv = system($cmd);
if ( $rv ) {
@@ -1703,7 +1719,7 @@ sub upgrade_spatial_extensions
my $sql = "ALTER EXTENSION postgis_raster UPDATE TO '${nextver}'";
if ( $OPT_UPGRADE_FROM =~ /^unpackaged/ ) {
- $sql = "CREATE EXTENSION postgis_raster VERSION '${nextver}' FROM unpackaged";
+ $sql = package_extension_sql('postgis_raster', ${nextver});
}
print "Upgrading PostGIS Raster in '${DB}' using: ${sql}\n" ;
@@ -1711,7 +1727,7 @@ sub upgrade_spatial_extensions
my $cmd = "psql $psql_opts -c \"" . $sql . "\" $DB >> $REGRESS_LOG 2>&1";
my $rv = system($cmd);
if ( $rv ) {
- fail "Error encountered altering EXTENSION POSTGIS_RASTER", $REGRESS_LOG;
+ fail "Error encountered updating EXTENSION POSTGIS_RASTER", $REGRESS_LOG;
die;
}
}
@@ -1721,7 +1737,7 @@ sub upgrade_spatial_extensions
my $sql = "ALTER EXTENSION postgis_topology UPDATE TO '${nextver}'";
if ( $OPT_UPGRADE_FROM =~ /^unpackaged/ ) {
- $sql = "CREATE EXTENSION postgis_topology VERSION '${nextver}' FROM unpackaged";
+ $sql = package_extension_sql('postgis_topology', ${nextver});
}
print "Upgrading PostGIS Topology in '${DB}' using: ${sql}\n";
@@ -1729,7 +1745,7 @@ sub upgrade_spatial_extensions
my $cmd = "psql $psql_opts -c \"" . $sql . "\" $DB >> $REGRESS_LOG 2>&1";
my $rv = system($cmd);
if ( $rv ) {
- fail "Error encountered altering EXTENSION POSTGIS_TOPOLOGY", $REGRESS_LOG;
+ fail "Error encountered updating EXTENSION POSTGIS_TOPOLOGY", $REGRESS_LOG;
die;
}
}
@@ -1739,7 +1755,7 @@ sub upgrade_spatial_extensions
my $sql;
if ( $OPT_UPGRADE_FROM =~ /^unpackaged/ ) {
- $sql = "CREATE EXTENSION postgis_sfcgal VERSION '${nextver}' FROM unpackaged";
+ $sql = package_extension_sql('postgis_sfcgal', ${nextver});
}
elsif ( $OPT_UPGRADE_FROM && semver_lessthan($OPT_UPGRADE_FROM, "2.2.0") )
{
diff --git a/utils/check_all_upgrades.sh b/utils/check_all_upgrades.sh
index f5fc9bb..80b9231 100755
--- a/utils/check_all_upgrades.sh
+++ b/utils/check_all_upgrades.sh
@@ -115,31 +115,23 @@ for EXT in ${INSTALLED_EXTENSIONS}; do
done
# Check unpackaged->extension upgrades
- #
- # NOTE: unsupported since PostgreSQL 13
- # See https://trac.osgeo.org/postgis/ticket/4643
- #
- export PGDATABASE=template1
- pg_version_num=`psql -XAtc "SELECT current_setting('server_version_num')"` || exit 1
- if test "$pg_version_num" -lt 130000; then
- for majmin in `'ls' -d ${CTBDIR}/postgis-* | sed 's/.*postgis-//'`; do
- UPGRADE_PATH="unpackaged${majmin}--${to_version_param}"
- # only consider versions older than ${to_version_param}
- cmp=`semver_compare "${majmin}" "${to_version_param}"`
- if test $cmp -ge 0; then
- echo "SKIP: upgrade $UPGRADE_PATH ($to_version_param is not newer than $majmin)"
- continue
- fi
- echo "Testing ${EXT} upgrade $UPGRADE_PATH"
- export RUNTESTFLAGS="-v --extension --upgrade-path=${UPGRADE_PATH}"
- make -C ${REGDIR} check && {
- echo "PASS: upgrade $UPGRADE_PATH"
- } || {
- echo "FAIL: upgrade $UPGRADE_PATH"
- failed
- }
- done
- fi
+ for majmin in `'ls' -d ${CTBDIR}/postgis-* | sed 's/.*postgis-//'`; do
+ UPGRADE_PATH="unpackaged${majmin}--${to_version_param}"
+ # only consider versions older than ${to_version_param}
+ cmp=`semver_compare "${majmin}" "${to_version_param}"`
+ if test $cmp -ge 0; then
+ echo "SKIP: upgrade $UPGRADE_PATH ($to_version_param is not newer than $majmin)"
+ continue
+ fi
+ echo "Testing ${EXT} upgrade $UPGRADE_PATH"
+ export RUNTESTFLAGS="-v --extension --upgrade-path=${UPGRADE_PATH}"
+ make -C ${REGDIR} check && {
+ echo "PASS: upgrade $UPGRADE_PATH"
+ } || {
+ echo "FAIL: upgrade $UPGRADE_PATH"
+ failed
+ }
+ done
done
-----------------------------------------------------------------------
Summary of changes:
extensions/postgis/Makefile.in | 4 ++++
extensions/postgis_raster/Makefile.in | 4 ++++
extensions/postgis_sfcgal/Makefile.in | 4 ++++
extensions/postgis_topology/Makefile.in | 4 ++++
postgis/postgis.sql.in | 20 ++++++++++++----
regress/run_test.pl | 34 +++++++++++++++++++-------
utils/check_all_upgrades.sh | 42 +++++++++++++--------------------
7 files changed, 73 insertions(+), 39 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list