@@ -26,19 +26,14 @@ BEGIN
|
|||||||
WHERE o_table_schema = schema_name AND o_table_catalog = current_database()
|
WHERE o_table_schema = schema_name AND o_table_catalog = current_database()
|
||||||
),
|
),
|
||||||
user_tables AS (
|
user_tables AS (
|
||||||
SELECT table_name FROM information_schema.tables
|
SELECT table_name FROM _CDB_NonAnalysisTablesInSchema(schema_name)
|
||||||
WHERE table_catalog = current_database() AND table_schema = schema_name
|
|
||||||
AND table_name != 'spatial_ref_sys'
|
|
||||||
AND table_name != 'cdb_tablemetadata'
|
|
||||||
AND table_type = 'BASE TABLE'
|
|
||||||
),
|
),
|
||||||
table_cat AS (
|
table_cat AS (
|
||||||
SELECT
|
SELECT
|
||||||
table_name,
|
table_name,
|
||||||
(
|
(
|
||||||
EXISTS(select * from raster_tables where o_table_name = table_name)
|
EXISTS(select * from raster_tables where o_table_name = table_name)
|
||||||
OR
|
OR table_name SIMILAR TO _CDB_OverviewTableDiscriminator() || '[\w\d]*'
|
||||||
table_name SIMILAR TO _CDB_OverviewTableDiscriminator() || '[\w\d]*'
|
|
||||||
) AS is_overview,
|
) AS is_overview,
|
||||||
EXISTS(SELECT * FROM raster_tables WHERE r_table_name = table_name) AS is_raster
|
EXISTS(SELECT * FROM raster_tables WHERE r_table_name = table_name) AS is_raster
|
||||||
FROM user_tables
|
FROM user_tables
|
||||||
|
|||||||
@@ -27,5 +27,21 @@ INSERT INTO big VALUES (8193);
|
|||||||
SELECT CDB_SetUserQuotaInBytes(0);
|
SELECT CDB_SetUserQuotaInBytes(0);
|
||||||
INSERT INTO big VALUES (8194);
|
INSERT INTO big VALUES (8194);
|
||||||
DROP TABLE big;
|
DROP TABLE big;
|
||||||
|
|
||||||
|
|
||||||
|
--analysis tables should be excluded from quota:
|
||||||
|
CREATE TABLE big(a int);
|
||||||
|
CREATE TRIGGER test_quota BEFORE UPDATE OR INSERT ON big
|
||||||
|
EXECUTE PROCEDURE CDB_CheckQuota(1, 1, 'public');
|
||||||
|
SELECT CDB_SetUserQuotaInBytes(1);
|
||||||
|
CREATE TABLE analysis_2f13a3dbd7_41bd92976fc6dd97072afe4ee450054f4c0715d4(id int);
|
||||||
|
INSERT INTO analysis_2f13a3dbd7_41bd92976fc6dd97072afe4ee450054f4c0715d4(id) VALUES (1),(2),(3),(4),(5);
|
||||||
|
INSERT INTO big VALUES (1); -- allowed, check runs before
|
||||||
|
DROP TABLE analysis_2f13a3dbd7_41bd92976fc6dd97072afe4ee450054f4c0715d4;
|
||||||
|
INSERT INTO big VALUES (2); -- disallowed, quota exceeds before
|
||||||
|
DROP TABLE big;
|
||||||
|
SELECT CDB_SetUserQuotaInBytes(0);
|
||||||
|
|
||||||
|
|
||||||
set client_min_messages to NOTICE;
|
set client_min_messages to NOTICE;
|
||||||
DROP FUNCTION _CDB_UserQuotaInBytes();
|
DROP FUNCTION _CDB_UserQuotaInBytes();
|
||||||
|
|||||||
@@ -18,5 +18,15 @@ ERROR: Quota exceeded by 443.998046875KB
|
|||||||
0
|
0
|
||||||
INSERT 0 1
|
INSERT 0 1
|
||||||
DROP TABLE
|
DROP TABLE
|
||||||
|
CREATE TABLE
|
||||||
|
CREATE TRIGGER
|
||||||
|
1
|
||||||
|
CREATE TABLE
|
||||||
|
INSERT 0 5
|
||||||
|
INSERT 0 1
|
||||||
|
DROP TABLE
|
||||||
|
ERROR: Quota exceeded by 3.9990234375KB
|
||||||
|
DROP TABLE
|
||||||
|
0
|
||||||
SET
|
SET
|
||||||
DROP FUNCTION
|
DROP FUNCTION
|
||||||
|
|||||||
Reference in New Issue
Block a user