From 1c7b0c71ec21baf1c4888bd2aa1f9eaa2c22fcfd Mon Sep 17 00:00:00 2001 From: Alberto Romeu Date: Fri, 20 Dec 2019 16:27:03 +0100 Subject: [PATCH 1/3] use literal substitution instead of identifier --- scripts-available/CDB_Quota.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts-available/CDB_Quota.sql b/scripts-available/CDB_Quota.sql index 96b41f2..9568b34 100644 --- a/scripts-available/CDB_Quota.sql +++ b/scripts-available/CDB_Quota.sql @@ -33,7 +33,7 @@ BEGIN IF raster_available THEN raster_read_query := Format('SELECT o_table_name, r_table_name FROM @postgisschema@.raster_overviews - WHERE o_table_schema = ''%I'' AND o_table_catalog = current_database()', schema_name); + WHERE o_table_schema = %L AND o_table_catalog = current_database()', schema_name); ELSE raster_read_query := 'SELECT NULL::text AS o_table_name, NULL::text AS r_table_name'; END IF; @@ -42,7 +42,7 @@ BEGIN %s ), user_tables AS ( - SELECT table_name FROM @extschema@._CDB_NonAnalysisTablesInSchema(''%I'') + SELECT table_name FROM @extschema@._CDB_NonAnalysisTablesInSchema(%L) ), table_cat AS ( SELECT @@ -55,7 +55,7 @@ BEGIN FROM user_tables ), sizes AS ( - SELECT COALESCE(INT8(SUM(@extschema@._CDB_total_relation_size(''%I'', table_name)))) table_size, + SELECT COALESCE(INT8(SUM(@extschema@._CDB_total_relation_size(%L, table_name)))) table_size, CASE WHEN is_overview THEN 0 WHEN is_raster THEN 1 From ec0d94dd0e3ad5c7ea1d10160ced167b8e71ccd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Tue, 24 Dec 2019 14:14:26 +0100 Subject: [PATCH 2/3] Add test for CDB_UserDataSize identifier quoation --- test/CDB_QuotaTest.sql | 3 +++ test/CDB_QuotaTest_expect | 3 +++ 2 files changed, 6 insertions(+) diff --git a/test/CDB_QuotaTest.sql b/test/CDB_QuotaTest.sql index bbb8753..670f4f6 100644 --- a/test/CDB_QuotaTest.sql +++ b/test/CDB_QuotaTest.sql @@ -60,6 +60,9 @@ SELECT 'excess3', catch_error($$INSERT INTO big VALUES (3);$$); -- disallowed, q DROP TABLE big; SELECT CDB_SetUserQuotaInBytes(0); +CREATE SCHEMA "complex-name%_with'quotes"""; +SELECT CDB_UserDataSize('"complex-name%_with''quotes"'); +DROP SCHEMA "complex-name%_with'quotes"""; set client_min_messages to NOTICE; DROP FUNCTION catch_error(text); diff --git a/test/CDB_QuotaTest_expect b/test/CDB_QuotaTest_expect index 49f9e7d..b982606 100644 --- a/test/CDB_QuotaTest_expect +++ b/test/CDB_QuotaTest_expect @@ -30,6 +30,9 @@ DROP TABLE excess3|t DROP TABLE 0 +CREATE SCHEMA +0 +DROP SCHEMA SET DROP FUNCTION DROP FUNCTION From b246ada3121e3c34d4b683c83a015d88215d1cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Tue, 24 Dec 2019 14:15:02 +0100 Subject: [PATCH 3/3] Update NEWS --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index fe2bd71..b752422 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ 0.35.0 (XXXX-XX-XX) * Reapply the changes in 0.33.0 (the issue we were looking for was unrelated) * Reapply `Make PG12 depend on plpython3u instead of plpythonu` +* Fix identifier quotation in `CDB_UserDataSize` 0.34.0 (2019-12-23) * Revert changes done in 0.33.0, keeping function signature to drop them