Always use @@plpythonu@@ as variable
This commit is contained in:
parent
ca1d5b0c91
commit
093e0bcb36
6
Makefile
6
Makefile
@ -150,7 +150,7 @@ $(EXTENSION)--$(EXTVERSION).sql: $(CDBSCRIPTS) cartodb_version.sql Makefile
|
|||||||
cat $(CDBSCRIPTS) | \
|
cat $(CDBSCRIPTS) | \
|
||||||
$(SED) -e 's/@extschema@/cartodb/g' \
|
$(SED) -e 's/@extschema@/cartodb/g' \
|
||||||
-e 's/@postgisschema@/public/g' \
|
-e 's/@postgisschema@/public/g' \
|
||||||
-e 's/plpythonu/$(PLPYTHONU)/g' >> $@
|
-e 's/@@plpythonu@@/$(PLPYTHONU)/g' >> $@
|
||||||
echo "GRANT USAGE ON SCHEMA cartodb TO public;" >> $@
|
echo "GRANT USAGE ON SCHEMA cartodb TO public;" >> $@
|
||||||
cat cartodb_version.sql >> $@
|
cat cartodb_version.sql >> $@
|
||||||
|
|
||||||
@ -164,10 +164,10 @@ $(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql: $(EXTENSION)--$(EXTVERSION).
|
|||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
$(EXTENSION).control: $(EXTENSION).control.in Makefile
|
$(EXTENSION).control: $(EXTENSION).control.in Makefile
|
||||||
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/g' -e 's/plpythonu/$(PLPYTHONU)/g' $< > $@
|
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/g' -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $< > $@
|
||||||
|
|
||||||
cartodb_version.sql: cartodb_version.sql.in Makefile $(GITDIR)/index
|
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" -e 's/plpythonu/$(PLPYTHONU)/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
|
# Needed for consistent `echo` results with backslashes
|
||||||
SHELL = bash
|
SHELL = bash
|
||||||
|
@ -3,4 +3,4 @@ comment = 'Turn a database into a cartodb user database.'
|
|||||||
superuser = true
|
superuser = true
|
||||||
relocatable = false
|
relocatable = false
|
||||||
schema = cartodb
|
schema = cartodb
|
||||||
requires = 'plpythonu, postgis'
|
requires = '@@plpythonu@@, postgis'
|
||||||
|
@ -191,7 +191,7 @@ AS $$
|
|||||||
})
|
})
|
||||||
return json.dumps(stats)
|
return json.dumps(stats)
|
||||||
$$
|
$$
|
||||||
LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE;
|
LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -45,7 +45,7 @@ AS $$
|
|||||||
plpy.warning('Error calling Invalidation Service to link Ghost Tables: ' + str(err))
|
plpy.warning('Error calling Invalidation Service to link Ghost Tables: ' + str(err))
|
||||||
break
|
break
|
||||||
tis_retry -= 1 # try reconnecting
|
tis_retry -= 1 # try reconnecting
|
||||||
$$ LANGUAGE 'plpythonu' VOLATILE PARALLEL UNSAFE;
|
$$ LANGUAGE '@@plpythonu@@' VOLATILE PARALLEL UNSAFE;
|
||||||
|
|
||||||
-- Enqueues a job to run Ghost tables linking process for the current user
|
-- Enqueues a job to run Ghost tables linking process for the current user
|
||||||
CREATE OR REPLACE FUNCTION @extschema@.CDB_LinkGhostTables(event_name text DEFAULT 'USER')
|
CREATE OR REPLACE FUNCTION @extschema@.CDB_LinkGhostTables(event_name text DEFAULT 'USER')
|
||||||
|
@ -21,7 +21,7 @@ $$
|
|||||||
body = '{ "name": "%s", "database_role": "%s" }' % (group_name, group_role)
|
body = '{ "name": "%s", "database_role": "%s" }' % (group_name, group_role)
|
||||||
query = "select @extschema@._CDB_Group_API_Request('POST', '%s', '%s', '{200, 409}') as response_status" % (url, body)
|
query = "select @extschema@._CDB_Group_API_Request('POST', '%s', '%s', '{200, 409}') as response_status" % (url, body)
|
||||||
plpy.execute(query)
|
plpy.execute(query)
|
||||||
$$ LANGUAGE 'plpythonu'
|
$$ LANGUAGE '@@plpythonu@@'
|
||||||
VOLATILE
|
VOLATILE
|
||||||
PARALLEL UNSAFE
|
PARALLEL UNSAFE
|
||||||
SECURITY DEFINER
|
SECURITY DEFINER
|
||||||
@ -41,7 +41,7 @@ $$
|
|||||||
|
|
||||||
query = "select @extschema@._CDB_Group_API_Request('DELETE', '%s', '', '{204, 404}') as response_status" % url
|
query = "select @extschema@._CDB_Group_API_Request('DELETE', '%s', '', '{204, 404}') as response_status" % url
|
||||||
plpy.execute(query)
|
plpy.execute(query)
|
||||||
$$ LANGUAGE 'plpythonu'
|
$$ LANGUAGE '@@plpythonu@@'
|
||||||
VOLATILE
|
VOLATILE
|
||||||
PARALLEL UNSAFE
|
PARALLEL UNSAFE
|
||||||
SECURITY DEFINER
|
SECURITY DEFINER
|
||||||
@ -61,7 +61,7 @@ $$
|
|||||||
body = '{ "name": "%s", "database_role": "%s" }' % (new_group_name, new_group_role)
|
body = '{ "name": "%s", "database_role": "%s" }' % (new_group_name, new_group_role)
|
||||||
query = "select @extschema@._CDB_Group_API_Request('PUT', '%s', '%s', '{200, 409}') as response_status" % (url, body)
|
query = "select @extschema@._CDB_Group_API_Request('PUT', '%s', '%s', '{200, 409}') as response_status" % (url, body)
|
||||||
plpy.execute(query)
|
plpy.execute(query)
|
||||||
$$ LANGUAGE 'plpythonu'
|
$$ LANGUAGE '@@plpythonu@@'
|
||||||
VOLATILE
|
VOLATILE
|
||||||
PARALLEL UNSAFE
|
PARALLEL UNSAFE
|
||||||
SECURITY DEFINER
|
SECURITY DEFINER
|
||||||
@ -81,7 +81,7 @@ $$
|
|||||||
body = "{ \"users\": [\"%s\"] }" % "\",\"".join(usernames)
|
body = "{ \"users\": [\"%s\"] }" % "\",\"".join(usernames)
|
||||||
query = "select @extschema@._CDB_Group_API_Request('POST', '%s', '%s', '{200, 409}') as response_status" % (url, body)
|
query = "select @extschema@._CDB_Group_API_Request('POST', '%s', '%s', '{200, 409}') as response_status" % (url, body)
|
||||||
plpy.execute(query)
|
plpy.execute(query)
|
||||||
$$ LANGUAGE 'plpythonu'
|
$$ LANGUAGE '@@plpythonu@@'
|
||||||
VOLATILE
|
VOLATILE
|
||||||
PARALLEL UNSAFE
|
PARALLEL UNSAFE
|
||||||
SECURITY DEFINER
|
SECURITY DEFINER
|
||||||
@ -101,7 +101,7 @@ $$
|
|||||||
body = "{ \"users\": [\"%s\"] }" % "\",\"".join(usernames)
|
body = "{ \"users\": [\"%s\"] }" % "\",\"".join(usernames)
|
||||||
query = "select @extschema@._CDB_Group_API_Request('DELETE', '%s', '%s', '{200, 404}') as response_status" % (url, body)
|
query = "select @extschema@._CDB_Group_API_Request('DELETE', '%s', '%s', '{200, 404}') as response_status" % (url, body)
|
||||||
plpy.execute(query)
|
plpy.execute(query)
|
||||||
$$ LANGUAGE 'plpythonu'
|
$$ LANGUAGE '@@plpythonu@@'
|
||||||
VOLATILE
|
VOLATILE
|
||||||
PARALLEL UNSAFE
|
PARALLEL UNSAFE
|
||||||
SECURITY DEFINER
|
SECURITY DEFINER
|
||||||
@ -129,7 +129,7 @@ $$
|
|||||||
body = '{ "access": "%s" }' % access
|
body = '{ "access": "%s" }' % access
|
||||||
query = "select @extschema@._CDB_Group_API_Request('PUT', '%s', '%s', '{200, 409}') as response_status" % (url, body)
|
query = "select @extschema@._CDB_Group_API_Request('PUT', '%s', '%s', '{200, 409}') as response_status" % (url, body)
|
||||||
plpy.execute(query)
|
plpy.execute(query)
|
||||||
$$ LANGUAGE 'plpythonu'
|
$$ LANGUAGE '@@plpythonu@@'
|
||||||
VOLATILE
|
VOLATILE
|
||||||
PARALLEL UNSAFE
|
PARALLEL UNSAFE
|
||||||
SECURITY DEFINER
|
SECURITY DEFINER
|
||||||
@ -156,7 +156,7 @@ $$
|
|||||||
url = '/api/v1/databases/{0}/groups/%s/permission/%s/tables/%s' % (pathname2url(group_name), username, table_name)
|
url = '/api/v1/databases/{0}/groups/%s/permission/%s/tables/%s' % (pathname2url(group_name), username, table_name)
|
||||||
query = "select @extschema@._CDB_Group_API_Request('DELETE', '%s', '', '{200, 404}') as response_status" % url
|
query = "select @extschema@._CDB_Group_API_Request('DELETE', '%s', '', '{200, 404}') as response_status" % url
|
||||||
plpy.execute(query)
|
plpy.execute(query)
|
||||||
$$ LANGUAGE 'plpythonu'
|
$$ LANGUAGE '@@plpythonu@@'
|
||||||
VOLATILE
|
VOLATILE
|
||||||
PARALLEL UNSAFE
|
PARALLEL UNSAFE
|
||||||
SECURITY DEFINER
|
SECURITY DEFINER
|
||||||
@ -191,7 +191,7 @@ $$
|
|||||||
params = json.loads(conf)
|
params = json.loads(conf)
|
||||||
auth = 'Basic %s' % plpy.execute("SELECT @extschema@._CDB_Group_API_Auth('%s', '%s') as auth" % (params['username'], params['password']))[0]['auth']
|
auth = 'Basic %s' % plpy.execute("SELECT @extschema@._CDB_Group_API_Auth('%s', '%s') as auth" % (params['username'], params['password']))[0]['auth']
|
||||||
return { "host": params['host'], "port": params['port'], 'timeout': params['timeout'], 'auth': auth }
|
return { "host": params['host'], "port": params['port'], 'timeout': params['timeout'], 'auth': auth }
|
||||||
$$ LANGUAGE 'plpythonu' VOLATILE PARALLEL UNSAFE;
|
$$ LANGUAGE '@@plpythonu@@' VOLATILE PARALLEL UNSAFE;
|
||||||
|
|
||||||
CREATE OR REPLACE
|
CREATE OR REPLACE
|
||||||
FUNCTION @extschema@._CDB_Group_API_Auth(username text, password text)
|
FUNCTION @extschema@._CDB_Group_API_Auth(username text, password text)
|
||||||
@ -199,7 +199,7 @@ FUNCTION @extschema@._CDB_Group_API_Auth(username text, password text)
|
|||||||
$$
|
$$
|
||||||
import base64
|
import base64
|
||||||
return base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
|
return base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
|
||||||
$$ LANGUAGE 'plpythonu' VOLATILE PARALLEL UNSAFE;
|
$$ LANGUAGE '@@plpythonu@@' VOLATILE PARALLEL UNSAFE;
|
||||||
|
|
||||||
-- url must contain a '%s' placeholder that will be replaced by current_database, for security reasons.
|
-- url must contain a '%s' placeholder that will be replaced by current_database, for security reasons.
|
||||||
CREATE OR REPLACE
|
CREATE OR REPLACE
|
||||||
@ -239,5 +239,5 @@ $$
|
|||||||
raise last_err
|
raise last_err
|
||||||
|
|
||||||
return None
|
return None
|
||||||
$$ LANGUAGE 'plpythonu' VOLATILE PARALLEL UNSAFE;
|
$$ LANGUAGE '@@plpythonu@@' VOLATILE PARALLEL UNSAFE;
|
||||||
revoke all on function @extschema@._CDB_Group_API_Request(text, text, text, int[]) from public;
|
revoke all on function @extschema@._CDB_Group_API_Request(text, text, text, int[]) from public;
|
||||||
|
@ -11,4 +11,4 @@ RETURNS SETOF TEXT AS $$
|
|||||||
cleaned = match[0].strip()
|
cleaned = match[0].strip()
|
||||||
if ( cleaned ):
|
if ( cleaned ):
|
||||||
yield cleaned
|
yield cleaned
|
||||||
$$ language 'plpythonu' IMMUTABLE STRICT PARALLEL SAFE;
|
$$ language '@@plpythonu@@' IMMUTABLE STRICT PARALLEL SAFE;
|
||||||
|
Loading…
Reference in New Issue
Block a user