2019-05-31 21:29:28 +08:00
|
|
|
CREATE OR REPLACE FUNCTION @extschema@.cdb_extension_reload() RETURNS void
|
2014-06-04 16:28:48 +08:00
|
|
|
AS $$
|
|
|
|
DECLARE
|
|
|
|
ver TEXT;
|
|
|
|
sql TEXT;
|
|
|
|
BEGIN
|
2019-05-31 21:29:28 +08:00
|
|
|
ver := split_part(@extschema@.cdb_version(), ' ', 1);
|
2014-06-04 16:28:48 +08:00
|
|
|
sql := 'ALTER EXTENSION cartodb UPDATE TO ''' || ver || 'next''';
|
|
|
|
EXECUTE sql;
|
|
|
|
sql := 'ALTER EXTENSION cartodb UPDATE TO ''' || ver || '''';
|
|
|
|
EXECUTE sql;
|
|
|
|
END;
|
2017-10-24 20:16:56 +08:00
|
|
|
$$ language 'plpgsql' VOLATILE PARALLEL UNSAFE;
|
2014-07-04 17:48:53 +08:00
|
|
|
|
2019-05-31 21:29:28 +08:00
|
|
|
CREATE OR REPLACE FUNCTION @extschema@.schema_exists(schema_name text)
|
2014-07-04 17:48:53 +08:00
|
|
|
RETURNS boolean AS
|
|
|
|
$$
|
2014-07-04 21:55:08 +08:00
|
|
|
SELECT EXISTS(SELECT 1 FROM pg_namespace WHERE nspname = schema_name::text);
|
2014-07-04 17:48:53 +08:00
|
|
|
$$
|
2017-10-24 20:16:56 +08:00
|
|
|
language sql STABLE PARALLEL SAFE;
|