Use plpython version of CDB_QueryStatements
This commit is contained in:
parent
bb21270aab
commit
ca367d0fe7
@ -1,9 +1,10 @@
|
|||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
postgresql: "9.3"
|
postgresql: "9.4"
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
|
- postgresql-plpython-9.4
|
||||||
- pkg-config
|
- pkg-config
|
||||||
- libcairo2-dev
|
- libcairo2-dev
|
||||||
- libjpeg8-dev
|
- libjpeg8-dev
|
||||||
|
@ -75,8 +75,8 @@ if test x"$PREPARE_PGSQL" = xyes; then
|
|||||||
dropdb "${TEST_DB}"
|
dropdb "${TEST_DB}"
|
||||||
createdb -Ttemplate_postgis -EUTF8 "${TEST_DB}" || die "Could not create test database"
|
createdb -Ttemplate_postgis -EUTF8 "${TEST_DB}" || die "Could not create test database"
|
||||||
|
|
||||||
LOCAL_SQL_SCRIPTS='_CDB_QueryStatements windshaft.test gadm4 ported/populated_places_simple_reduced'
|
LOCAL_SQL_SCRIPTS='windshaft.test gadm4 ported/populated_places_simple_reduced'
|
||||||
REMOTE_SQL_SCRIPTS='CDB_QueryTables CDB_CartodbfyTable CDB_TableMetadata CDB_ForeignTable CDB_UserTables CDB_ColumnNames CDB_AnalysisCatalog CDB_ZoomFromScale CDB_Overviews CDB_QuantileBins CDB_JenksBins CDB_HeadsTailsBins CDB_EqualIntervalBins CDB_Hexagon CDB_XYZ'
|
REMOTE_SQL_SCRIPTS='CDB_QueryStatements CDB_QueryTables CDB_CartodbfyTable CDB_TableMetadata CDB_ForeignTable CDB_UserTables CDB_ColumnNames CDB_AnalysisCatalog CDB_ZoomFromScale CDB_Overviews CDB_QuantileBins CDB_JenksBins CDB_HeadsTailsBins CDB_EqualIntervalBins CDB_Hexagon CDB_XYZ'
|
||||||
|
|
||||||
CURL_ARGS=""
|
CURL_ARGS=""
|
||||||
for i in ${REMOTE_SQL_SCRIPTS}
|
for i in ${REMOTE_SQL_SCRIPTS}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
-- DUMMY IMPLEMENTATION
|
|
||||||
-- Ref: https://github.com/CartoDB/cartodb-postgresql/blob/master/scripts-available/CDB_QueryStatements.sql
|
|
||||||
-- Originally implemented in plpython for performance reasons
|
|
||||||
|
|
||||||
-- Return an array of statements found in the given query text
|
|
||||||
--
|
|
||||||
-- Regexp curtesy of Hubert Lubaczewski (depesz)
|
|
||||||
--
|
|
||||||
CREATE OR REPLACE FUNCTION CDB_QueryStatements(query text)
|
|
||||||
RETURNS SETOF TEXT AS $$
|
|
||||||
with matches as (
|
|
||||||
select regexp_matches($1, $regexp$((?:[^'"$;]+|"[^"]*"|'[^']*'|(\$[^$]*\$).*?\2)+)$regexp$, 'g') as m
|
|
||||||
)
|
|
||||||
select btrim(m[1]) from matches
|
|
||||||
$$
|
|
||||||
LANGUAGE SQL IMMUTABLE STRICT;
|
|
Loading…
Reference in New Issue
Block a user