Fix: cdb_conf table is not accessible to regular users

This commit is contained in:
Javier Goizueta 2016-10-11 17:52:11 +02:00
parent 4786e0a2ae
commit 066c574709

View File

@ -1,3 +1,15 @@
-- Read configuration parameter analysis_quota_factor, making it
-- accessible to regular users (which don't have access to cdb_conf)
CREATE OR REPLACE FUNCTION _CDB_GetConfAnalysisQuotaFactor()
RETURNS float8 AS
$$
BEGIN
RETURN CDB_Conf_GetConf('analysis_quota_factor')::text::float8;
END;
$$
LANGUAGE 'plpgsql' STABLE SECURITY DEFINER;
-- Get the factor (fraction of the quota) for Camshaft cached analysis tables -- Get the factor (fraction of the quota) for Camshaft cached analysis tables
CREATE OR REPLACE FUNCTION _CDB_AnalysisQuotaFactor() CREATE OR REPLACE FUNCTION _CDB_AnalysisQuotaFactor()
RETURNS float8 AS RETURNS float8 AS
@ -6,7 +18,7 @@ DECLARE
factor float8; factor float8;
BEGIN BEGIN
-- We use a floating point cdb_conf parameter -- We use a floating point cdb_conf parameter
SELECT cdb_conf_getconf::text::float8 INTO factor FROM CDB_Conf_GetConf('analysis_cache_factor'); factor := _CDB_GetConfAnalysisQuotaFactor();
-- With a default value -- With a default value
IF factor IS NULL THEN IF factor IS NULL THEN
factor := 0.2; factor := 0.2;