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);
|
2015-08-13 19:23:35 +08:00
|
|
|
-- Test for #108: https://github.com/CartoDB/cartodb-postgresql/issues/108
|
|
|
|
SELECT CDB_UserDataSize();
|
|
|
|
SELECT cartodb._CDB_total_relation_size('public', 'big');
|
|
|
|
SELECT cartodb._CDB_total_relation_size('public', 'nonexistent_table_name');
|
|
|
|
-- END Test for #108
|
2015-02-17 22:40:26 +08:00
|
|
|
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();
|