CDB_SetUserQuotaInBytes returning set value instead of previous value.
This commit is contained in:
parent
5806ac8f8d
commit
2bd0b223a6
@ -84,26 +84,18 @@ CREATE OR REPLACE FUNCTION CDB_SetUserQuotaInBytes(schema_name text, bytes int8)
|
||||
RETURNS int8 AS
|
||||
$$
|
||||
DECLARE
|
||||
current_quota int8;
|
||||
schema_ok boolean;
|
||||
sql text;
|
||||
BEGIN
|
||||
IF cartodb.schema_exists(schema_name::text) = false THEN
|
||||
RAISE EXCEPTION 'Invalid schema name "%"', schema_name::text;
|
||||
END IF;
|
||||
|
||||
BEGIN
|
||||
EXECUTE FORMAT('SELECT %I._CDB_UserQuotaInBytes();', schema_name::text) INTO current_quota;
|
||||
EXCEPTION WHEN undefined_function THEN
|
||||
current_quota := 0;
|
||||
END;
|
||||
|
||||
sql := 'CREATE OR REPLACE FUNCTION "' || schema_name::text || '"._CDB_UserQuotaInBytes() '
|
||||
|| 'RETURNS int8 AS $X$ SELECT ' || bytes
|
||||
|| '::int8 $X$ LANGUAGE sql IMMUTABLE';
|
||||
EXECUTE sql;
|
||||
|
||||
return current_quota;
|
||||
return bytes;
|
||||
END
|
||||
$$
|
||||
LANGUAGE 'plpgsql' VOLATILE STRICT;
|
||||
|
@ -6,9 +6,9 @@ ERROR: Quota exceeded by 3.9990234375KB
|
||||
0
|
||||
|
||||
INSERT 0 1024
|
||||
0
|
||||
ERROR: Quota exceeded by 103.9921875KB
|
||||
8
|
||||
ERROR: Quota exceeded by 103.9921875KB
|
||||
0
|
||||
INSERT 0 1
|
||||
DROP TABLE
|
||||
SET
|
||||
|
Loading…
Reference in New Issue
Block a user