2015-02-17 22:40:26 +08:00
|
|
|
set client_min_messages to error;
|
|
|
|
\set VERBOSITY default
|
|
|
|
|
2014-05-08 23:14:06 +08:00
|
|
|
CREATE TABLE big(a int);
|
2014-05-09 18:55:41 +08:00
|
|
|
-- Try the legacy interface
|
|
|
|
-- See https://github.com/CartoDB/cartodb-postgresql/issues/13
|
|
|
|
CREATE TRIGGER test_quota BEFORE UPDATE OR INSERT ON big
|
2014-07-04 21:55:08 +08:00
|
|
|
EXECUTE PROCEDURE CDB_CheckQuota(1, 1, 'public');
|
2014-05-09 18:55:41 +08:00
|
|
|
INSERT INTO big VALUES (1); -- allowed, check runs before
|
|
|
|
INSERT INTO big VALUES (1); -- disallowed, quota exceeds before
|
2014-05-12 19:07:47 +08:00
|
|
|
SELECT CDB_SetUserQuotaInBytes(0);
|
2014-05-08 23:14:06 +08:00
|
|
|
SELECT CDB_CartodbfyTable('big');
|
2015-02-17 22:40:26 +08:00
|
|
|
INSERT INTO big SELECT generate_series(1,2048);
|
|
|
|
INSERT INTO big SELECT generate_series(1,2048);
|
|
|
|
INSERT INTO big SELECT generate_series(1,2048);
|
|
|
|
SELECT CDB_SetUserQuotaInBytes(2);
|
2014-05-08 23:14:06 +08:00
|
|
|
INSERT INTO big VALUES (1);
|
|
|
|
SELECT CDB_SetUserQuotaInBytes(0);
|
|
|
|
INSERT INTO big VALUES (1);
|
|
|
|
DROP TABLE big;
|
|
|
|
set client_min_messages to NOTICE;
|
2014-05-12 19:07:47 +08:00
|
|
|
DROP FUNCTION _CDB_UserQuotaInBytes();
|