Set safe schema on some functions

This commit is contained in:
Raul Marin 2019-10-03 17:37:11 +02:00
parent 0e891eff7f
commit a580bedefc
3 changed files with 17 additions and 5 deletions

View File

@ -6,8 +6,11 @@ $$
BEGIN BEGIN
RETURN @extschema@.CDB_Conf_GetConf('analysis_quota_factor')::text::float8; RETURN @extschema@.CDB_Conf_GetConf('analysis_quota_factor')::text::float8;
END; END;
$$ $$ LANGUAGE 'plpgsql'
LANGUAGE 'plpgsql' STABLE PARALLEL SAFE SECURITY DEFINER; STABLE
PARALLEL SAFE
SECURITY DEFINER
SET search_path = pg_temp;
-- Get the factor (fraction of the quota) for Camshaft cached analysis tables -- Get the factor (fraction of the quota) for Camshaft cached analysis tables

View File

@ -12,7 +12,12 @@ BEGIN
EXECUTE Format('ANALYZE %s;', reloid); EXECUTE Format('ANALYZE %s;', reloid);
END IF; END IF;
END END
$$ LANGUAGE 'plpgsql' VOLATILE STRICT PARALLEL UNSAFE SECURITY DEFINER; $$ LANGUAGE 'plpgsql'
VOLATILE
STRICT
PARALLEL UNSAFE
SECURITY DEFINER
SET search_path = pg_temp;
-- Return a row count estimate of the result of a query using statistics -- Return a row count estimate of the result of a query using statistics
CREATE OR REPLACE FUNCTION @extschema@.CDB_EstimateRowCount(query text) CREATE OR REPLACE FUNCTION @extschema@.CDB_EstimateRowCount(query text)

View File

@ -318,7 +318,7 @@ $$ LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE;
-- This function is declared SECURITY DEFINER so it executes with the privileges -- This function is declared SECURITY DEFINER so it executes with the privileges
-- of the function creator to have a chance to alter the privileges of the -- of the function creator to have a chance to alter the privileges of the
-- overview table to match those of the dataset. It will only perform any change -- overview table to match those of the dataset. It will only perform any change
-- if the overview table belgons to the same scheme as the dataset and it -- if the overview table belongs to the same scheme as the dataset and it
-- matches the scheme naming for overview tables. -- matches the scheme naming for overview tables.
CREATE OR REPLACE FUNCTION @extschema@._CDB_Register_Overview(dataset REGCLASS, overview_table REGCLASS, overview_z INTEGER) CREATE OR REPLACE FUNCTION @extschema@._CDB_Register_Overview(dataset REGCLASS, overview_table REGCLASS, overview_z INTEGER)
RETURNS VOID RETURNS VOID
@ -362,7 +362,11 @@ AS $$
-- it should be done here (CDB_Overviews would consume such metadata) -- it should be done here (CDB_Overviews would consume such metadata)
END IF; END IF;
END END
$$ LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE SECURITY DEFINER; $$ LANGUAGE PLPGSQL
VOLATILE
PARALLEL UNSAFE
SECURITY DEFINER
SET search_path = pg_temp;
-- Dataset attributes (column names other than the -- Dataset attributes (column names other than the
-- CartoDB primary key and geometry columns) which should be aggregated -- CartoDB primary key and geometry columns) which should be aggregated