Fixes CDB_UserDataSize failing due ERROR: relation "*" does not exist.
Adds new _CDB_total_relation_size function that handles nonexistent tables and does fallback to size=0. That function could be used to cache total relation size or query another table view with a cached total relation size. Fixes #108
This commit is contained in:
@@ -13,6 +13,11 @@ SELECT CDB_CartodbfyTable('big');
|
||||
INSERT INTO big SELECT generate_series(1,2048);
|
||||
INSERT INTO big SELECT generate_series(1,2048);
|
||||
INSERT INTO big SELECT generate_series(1,2048);
|
||||
-- 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
|
||||
SELECT CDB_SetUserQuotaInBytes(2);
|
||||
INSERT INTO big VALUES (1);
|
||||
SELECT CDB_SetUserQuotaInBytes(0);
|
||||
|
||||
@@ -8,6 +8,9 @@ ERROR: Quota exceeded by 3.9990234375KB
|
||||
INSERT 0 2048
|
||||
INSERT 0 2048
|
||||
INSERT 0 2048
|
||||
581632
|
||||
1163264
|
||||
0
|
||||
2
|
||||
ERROR: Quota exceeded by 567.998046875KB
|
||||
0
|
||||
|
||||
Reference in New Issue
Block a user