Force all PG12 to use plpython3u

This commit is contained in:
Raul Marin 2019-10-22 15:29:45 +02:00
parent 3b4669df11
commit aed88fd958
4 changed files with 103 additions and 4 deletions

View File

@ -24,7 +24,7 @@ script:
- if [[ $POSTGRESQL_VERSION == '9.6' ]]; then sudo apt-get install -y postgresql-contrib-9.6; fi;
- sudo apt-get install -y --allow-unauthenticated postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION-scripts postgis
# For pre12, install plpython2. For PG12 install plpython3 and make it default
- if [[ $POSTGRESQL_VERSION != '12' ]]; then sudo apt-get install -y postgresql-plpython-$POSTGRESQL_VERSION && sudo pip install redis==2.4.9; else sudo apt-get install -y postgresql-plpython3-12 && find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/plpythonu/plpython3u/g' && pip3 install redis; fi;
- if [[ $POSTGRESQL_VERSION != '12' ]]; then sudo apt-get install -y postgresql-plpython-$POSTGRESQL_VERSION && sudo pip install redis==2.4.9; else sudo apt-get install -y postgresql-plpython3-12 && pip3 install redis==2.4.9; fi;
- sudo pg_dropcluster --stop $POSTGRESQL_VERSION main
- sudo rm -rf /etc/postgresql/$POSTGRESQL_VERSION /var/lib/postgresql/$POSTGRESQL_VERSION
- sudo pg_createcluster -u postgres $POSTGRESQL_VERSION main -- --auth-local trust --auth-host password

View File

@ -134,12 +134,18 @@ PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
PG_VERSION := $(shell $(PG_CONFIG) --version | $(AWK) '{split($$2,a,"."); print a[1]}')
PG_12_GE := $(shell [ $(PG_VERSION) -ge 12 ] && echo true)
PLPYTHONU := "plpythonu"
ifeq ($(PG_12_GE), true)
PLPYTHONU := "plpython3u"
endif
$(EXTENSION)--$(EXTVERSION).sql: $(CDBSCRIPTS) cartodb_version.sql Makefile
echo '\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \quit' > $@
cat $(CDBSCRIPTS) | \
$(SED) -e 's/@extschema@/cartodb/g' \
-e "s/@postgisschema@/public/g" >> $@
-e 's/@postgisschema@/public/g' \
-e 's/plpythonu/$(PLPYTHONU)/g' >> $@
echo "GRANT USAGE ON SCHEMA cartodb TO public;" >> $@
cat cartodb_version.sql >> $@
@ -153,10 +159,10 @@ $(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql: $(EXTENSION)--$(EXTVERSION).
cp $< $@
$(EXTENSION).control: $(EXTENSION).control.in Makefile
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' $< > $@
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/g' -e 's/plpythonu/$(PLPYTHONU)/g' $< > $@
cartodb_version.sql: cartodb_version.sql.in Makefile $(GITDIR)/index
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' -e 's/@extschema@/cartodb/g' -e "s/@postgisschema@/public/g" $< > $@
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' -e 's/@extschema@/cartodb/g' -e "s/@postgisschema@/public/g" -e 's/plpythonu/$(PLPYTHONU)/g' $< > $@
# Needed for consistent `echo` results with backslashes
SHELL = bash

View File

@ -1,3 +1,6 @@
0.32.0 (XXXX-XX-XX)
* Make PG12 depend on plpython3u instead of plpythonu
0.31.0 (2019-10-08)
* Ghost tables: Add missing tags (#370)
* Set search_path in security definer functions.

View File

@ -0,0 +1,90 @@
CREATE TABLE
INSERT 0 1
SELECT 1
CREATE VIEW
SELECT 1
SELECT 1
1
1
1
1
1
ERROR: permission denied for table test
ERROR: permission denied for table test_tablesas
ERROR: permission denied for view test_view
ERROR: permission denied for materialized view test_mview
ERROR: permission denied for table test_selectinto
DROP TABLE
DROP VIEW
DROP MATERIALIZED VIEW
DROP TABLE
DROP TABLE
NOTICE: event trigger "oauth_reassign_tables_trigger" does not exist, skipping
CREATE TABLE
INSERT 0 1
SELECT 1
CREATE VIEW
SELECT 1
SELECT 1
1
1
1
1
1
ERROR: permission denied for table test2
ERROR: permission denied for table test2_tablesas
ERROR: permission denied for view test2_view
ERROR: permission denied for materialized view test2_mview
ERROR: permission denied for table test2_selectinto
DROP TABLE
DROP VIEW
DROP MATERIALIZED VIEW
DROP TABLE
DROP TABLE
CREATE TABLE
INSERT 0 1
SELECT 1
CREATE VIEW
SELECT 1
SELECT 1
1
1
1
1
1
ERROR: permission denied for table test3
ERROR: permission denied for table test3_tablesas
ERROR: permission denied for view test3_view
ERROR: permission denied for materialized view test3_mview
ERROR: permission denied for table test3_selectinto
DROP TABLE
DROP VIEW
DROP MATERIALIZED VIEW
DROP TABLE
DROP TABLE
CREATE TABLE
INSERT 0 1
SELECT 1
CREATE VIEW
SELECT 1
SELECT 1
1
1
1
1
1
1
1
1
1
1
DROP TABLE
DROP VIEW
DROP MATERIALIZED VIEW
DROP TABLE
DROP TABLE