|
42 | 42 | FROM (
|
43 | 43 | SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM (
|
44 | 44 | SELECT
|
45 |
| - sum(pg_total_relation_size('"' || c.schema_name || '"."' || c.table_name || '"'))::bigint as total_bytes, |
46 |
| - sum(pg_indexes_size('"' || c.schema_name || '"."' || c.table_name || '"'))::bigint AS index_bytes, |
| 45 | + sum(pg_total_relation_size(format('%%I.%%I', c.schema_name, c.table_name)))::bigint as total_bytes, |
| 46 | + sum(pg_indexes_size(format('%%I.%%I', c.schema_name, c.table_name)))::bigint AS index_bytes, |
47 | 47 | sum(pg_total_relation_size(reltoastrelid))::bigint AS toast_bytes
|
48 | 48 | FROM
|
49 | 49 | _timescaledb_catalog.hypertable h,
|
@@ -104,8 +104,7 @@ BEGIN
|
104 | 104 | IF d.partitioning_func IS NULL THEN
|
105 | 105 | RETURN d.column_name;
|
106 | 106 | ELSE
|
107 |
| - RETURN d.partitioning_func_schema || '.' || d.partitioning_func |
108 |
| - || '(' || d.column_name || ')'; |
| 107 | + RETURN format('%I.%I(%I)', d.partitioning_func_schema, d.partitioning_func, d.column_name); |
109 | 108 | END IF;
|
110 | 109 | END
|
111 | 110 | $BODY$;
|
@@ -209,9 +208,9 @@ BEGIN
|
209 | 208 | total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes
|
210 | 209 | FROM (
|
211 | 210 | SELECT c.id as chunk_id,
|
212 |
| - '"' || c.schema_name || '"."' || c.table_name || '"' as chunk_table, |
213 |
| - pg_total_relation_size('"' || c.schema_name || '"."' || c.table_name || '"') AS total_bytes, |
214 |
| - pg_indexes_size('"' || c.schema_name || '"."' || c.table_name || '"') AS index_bytes, |
| 211 | + format('%%I.%%I', c.schema_name, c.table_name) as chunk_table, |
| 212 | + pg_total_relation_size(format('%%I.%%I', c.schema_name, c.table_name)) AS total_bytes, |
| 213 | + pg_indexes_size(format('%%I.%%I', c.schema_name, c.table_name)) AS index_bytes, |
215 | 214 | pg_total_relation_size(reltoastrelid) AS toast_bytes,
|
216 | 215 | array_agg(d.column_name ORDER BY d.interval_length, d.column_name ASC) as partitioning_columns,
|
217 | 216 | array_agg(d.column_type ORDER BY d.interval_length, d.column_name ASC) as partitioning_column_types,
|
@@ -308,9 +307,9 @@ BEGIN
|
308 | 307 | total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes
|
309 | 308 | FROM (
|
310 | 309 | SELECT c.id as chunk_id,
|
311 |
| - '"' || c.schema_name || '"."' || c.table_name || '"' as chunk_table, |
312 |
| - pg_total_relation_size('"' || c.schema_name || '"."' || c.table_name || '"') AS total_bytes, |
313 |
| - pg_indexes_size('"' || c.schema_name || '"."' || c.table_name || '"') AS index_bytes, |
| 310 | + format('%%I.%%I', c.schema_name, c.table_name) as chunk_table, |
| 311 | + pg_total_relation_size(format('%%I.%%I', c.schema_name, c.table_name)) AS total_bytes, |
| 312 | + pg_indexes_size(format('%%I.%%I', c.schema_name, c.table_name)) AS index_bytes, |
314 | 313 | pg_total_relation_size(reltoastrelid) AS toast_bytes,
|
315 | 314 | array_agg(d.column_name ORDER BY d.interval_length, d.column_name ASC) as partitioning_columns,
|
316 | 315 | array_agg(d.column_type ORDER BY d.interval_length, d.column_name ASC) as partitioning_column_types,
|
@@ -374,7 +373,7 @@ BEGIN
|
374 | 373 | WHERE c.OID = main_table;
|
375 | 374 |
|
376 | 375 | RETURN QUERY
|
377 |
| - SELECT h.schema_name || '.' || ci.hypertable_index_name, |
| 376 | + SELECT format('%I.%I', h.schema_name, ci.hypertable_index_name), |
378 | 377 | sum(pg_relation_size(c.oid))::bigint
|
379 | 378 | FROM
|
380 | 379 | pg_class c,
|
|
0 commit comments