diff --git a/scripts-available/CDB_AnalysisCheck.sql b/scripts-available/CDB_AnalysisCheck.sql index ff30f2f..c8dddf3 100644 --- a/scripts-available/CDB_AnalysisCheck.sql +++ b/scripts-available/CDB_AnalysisCheck.sql @@ -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 CREATE OR REPLACE FUNCTION _CDB_AnalysisQuotaFactor() RETURNS float8 AS @@ -6,7 +18,7 @@ DECLARE factor float8; BEGIN -- 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 IF factor IS NULL THEN factor := 0.2;