|
| 1 | +-- This file and its contents are licensed under the Apache License 2.0. |
| 2 | +-- Please see the included NOTICE for copyright information and |
| 3 | +-- LICENSE-APACHE for a copy of the license. |
| 4 | + |
| 5 | +-- Redefinition of our external views without dependencies on catalog tables. |
| 6 | +-- |
| 7 | +-- During extension upgrade we replace the views with the ones defined in this file, |
| 8 | +-- which have the same columns but no dependencies on the underlying tables. |
| 9 | +-- This allows users to keep dependencies on the views and not block extension |
| 10 | +-- upgrades. |
| 11 | + |
| 12 | +CREATE OR REPLACE VIEW timescaledb_information.hypertables AS |
| 13 | +SELECT |
| 14 | + NULL::name AS hypertable_schema, |
| 15 | + NULL::name AS hypertable_name, |
| 16 | + NULL::name AS owner, |
| 17 | + NULL::smallint AS num_dimensions, |
| 18 | + NULL::bigint AS num_chunks, |
| 19 | + NULL::boolean AS compression_enabled, |
| 20 | + NULL::name[] AS tablespaces, |
| 21 | + NULL::name AS primary_dimension, |
| 22 | + NULL::regtype AS primary_dimension_type; |
| 23 | + |
| 24 | +CREATE OR REPLACE VIEW timescaledb_information.job_stats AS |
| 25 | +SELECT |
| 26 | + NULL::name AS hypertable_schema, |
| 27 | + NULL::name AS hypertable_name, |
| 28 | + NULL::integer AS job_id, |
| 29 | + NULL::timestamptz AS last_run_started_at, |
| 30 | + NULL::timestamptz AS last_successful_finish, |
| 31 | + NULL::text AS last_run_status, |
| 32 | + NULL::text AS job_status, |
| 33 | + NULL::interval AS last_run_duration, |
| 34 | + NULL::timestamptz AS next_start, |
| 35 | + NULL::bigint AS total_runs, |
| 36 | + NULL::bigint AS total_successes, |
| 37 | + NULL::bigint AS total_failures; |
| 38 | + |
| 39 | +CREATE OR REPLACE VIEW timescaledb_information.jobs AS |
| 40 | +SELECT |
| 41 | + NULL::integer AS job_id, |
| 42 | + NULL::name AS application_name, |
| 43 | + NULL::interval AS schedule_interval, |
| 44 | + NULL::interval AS max_runtime, |
| 45 | + NULL::integer AS max_retries, |
| 46 | + NULL::interval AS retry_period, |
| 47 | + NULL::name AS proc_schema, |
| 48 | + NULL::name AS proc_name, |
| 49 | + NULL::regrole AS owner, |
| 50 | + NULL::boolean AS scheduled, |
| 51 | + NULL::boolean AS fixed_schedule, |
| 52 | + NULL::jsonb AS config, |
| 53 | + NULL::timestamptz AS next_start, |
| 54 | + NULL::timestamptz AS initial_start, |
| 55 | + NULL::name AS hypertable_schema, |
| 56 | + NULL::name AS hypertable_name, |
| 57 | + NULL::name AS check_schema, |
| 58 | + NULL::name AS check_name; |
| 59 | + |
| 60 | +CREATE OR REPLACE VIEW timescaledb_information.continuous_aggregates AS |
| 61 | +SELECT |
| 62 | + NULL::name AS hypertable_schema, |
| 63 | + NULL::name AS hypertable_name, |
| 64 | + NULL::name AS view_schema, |
| 65 | + NULL::name AS view_name, |
| 66 | + NULL::name AS view_owner, |
| 67 | + NULL::boolean AS materialized_only, |
| 68 | + NULL::boolean AS compression_enabled, |
| 69 | + NULL::name AS materialization_hypertable_schema, |
| 70 | + NULL::name AS materialization_hypertable_name, |
| 71 | + NULL::text AS view_definition; |
| 72 | + |
| 73 | +CREATE OR REPLACE VIEW timescaledb_information.chunks AS |
| 74 | +SELECT |
| 75 | + NULL::name AS hypertable_schema, |
| 76 | + NULL::name AS hypertable_name, |
| 77 | + NULL::name AS chunk_schema, |
| 78 | + NULL::name AS chunk_name, |
| 79 | + NULL::name AS primary_dimension, |
| 80 | + NULL::regtype AS primary_dimension_type, |
| 81 | + NULL::timestamptz AS range_start, |
| 82 | + NULL::timestamptz AS range_end, |
| 83 | + NULL::bigint AS range_start_integer, |
| 84 | + NULL::bigint AS range_end_integer, |
| 85 | + NULL::boolean AS is_compressed, |
| 86 | + NULL::name AS chunk_tablespace, |
| 87 | + NULL::timestamptz AS chunk_creation_time; |
| 88 | + |
| 89 | +CREATE OR REPLACE VIEW timescaledb_information.dimensions AS |
| 90 | +SELECT |
| 91 | + NULL::name AS hypertable_schema, |
| 92 | + NULL::name AS hypertable_name, |
| 93 | + NULL::bigint AS dimension_number, |
| 94 | + NULL::name AS column_name, |
| 95 | + NULL::regtype AS column_type, |
| 96 | + NULL::text AS dimension_type, |
| 97 | + NULL::interval AS time_interval, |
| 98 | + NULL::bigint AS integer_interval, |
| 99 | + NULL::name AS integer_now_func, |
| 100 | + NULL::smallint AS num_partitions; |
| 101 | + |
| 102 | +CREATE OR REPLACE VIEW timescaledb_information.compression_settings AS |
| 103 | +SELECT |
| 104 | + NULL::name AS hypertable_schema, |
| 105 | + NULL::name AS hypertable_name, |
| 106 | + NULL::name AS attname, |
| 107 | + NULL::smallint AS segmentby_column_index, |
| 108 | + NULL::smallint AS orderby_column_index, |
| 109 | + NULL::boolean AS orderby_asc, |
| 110 | + NULL::boolean AS orderby_nullsfirst; |
| 111 | + |
| 112 | +CREATE OR REPLACE VIEW timescaledb_information.job_errors |
| 113 | +WITH (security_barrier = true) AS |
| 114 | +SELECT |
| 115 | + NULL::integer AS job_id, |
| 116 | + NULL::text AS proc_schema, |
| 117 | + NULL::text AS proc_name, |
| 118 | + NULL::integer AS pid, |
| 119 | + NULL::timestamptz AS start_time, |
| 120 | + NULL::timestamptz AS finish_time, |
| 121 | + NULL::text AS sqlerrcode, |
| 122 | + NULL::text AS err_message; |
| 123 | + |
| 124 | +CREATE OR REPLACE VIEW timescaledb_information.job_history |
| 125 | +WITH (security_barrier = true) AS |
| 126 | +SELECT |
| 127 | + NULL::bigint AS id, |
| 128 | + NULL::integer AS job_id, |
| 129 | + NULL::boolean AS succeeded, |
| 130 | + NULL::text COLLATE "C" AS proc_schema, |
| 131 | + NULL::text COLLATE "C" AS proc_name, |
| 132 | + NULL::integer AS pid, |
| 133 | + NULL::timestamptz AS start_time, |
| 134 | + NULL::timestamptz AS finish_time, |
| 135 | + NULL::jsonb AS config, |
| 136 | + NULL::text AS sqlerrcode, |
| 137 | + NULL::text AS err_message; |
| 138 | + |
| 139 | +CREATE OR REPLACE VIEW timescaledb_information.hypertable_compression_settings AS |
| 140 | +SELECT |
| 141 | + NULL::regclass AS hypertable, |
| 142 | + NULL::text AS segmentby, |
| 143 | + NULL::text AS orderby, |
| 144 | + NULL::text AS compress_interval_length, |
| 145 | + NULL::jsonb AS index; |
| 146 | + |
| 147 | +CREATE OR REPLACE VIEW timescaledb_information.chunk_compression_settings AS |
| 148 | +SELECT |
| 149 | + NULL::regclass AS hypertable, |
| 150 | + NULL::regclass AS chunk, |
| 151 | + NULL::text AS segmentby, |
| 152 | + NULL::text AS orderby, |
| 153 | + NULL::jsonb AS index; |
| 154 | + |
| 155 | +CREATE OR REPLACE VIEW timescaledb_information.hypertable_columnstore_settings AS |
| 156 | +SELECT |
| 157 | + NULL::regclass AS hypertable, |
| 158 | + NULL::text AS segmentby, |
| 159 | + NULL::text AS orderby, |
| 160 | + NULL::text AS compress_interval_length, |
| 161 | + NULL::jsonb AS index; |
| 162 | + |
| 163 | +CREATE OR REPLACE VIEW timescaledb_information.chunk_columnstore_settings AS |
| 164 | +SELECT |
| 165 | + NULL::regclass AS hypertable, |
| 166 | + NULL::regclass AS chunk, |
| 167 | + NULL::text AS segmentby, |
| 168 | + NULL::text AS orderby, |
| 169 | + NULL::jsonb AS index; |
| 170 | + |
| 171 | +CREATE OR REPLACE VIEW timescaledb_information.stat_chunk_activity AS |
| 172 | +SELECT |
| 173 | + NULL::regclass AS chunk, |
| 174 | + NULL::regclass AS compressed_chunk, |
| 175 | + NULL::integer AS chunk_id, |
| 176 | + NULL::integer AS hypertable_id, |
| 177 | + NULL::name AS hypertable, |
| 178 | + NULL::bigint AS compressed_batch_count, |
| 179 | + NULL::bigint AS compressed_block_count, |
| 180 | + NULL::bigint AS compressed_batch_rows_min, |
| 181 | + NULL::bigint AS compressed_batch_rows_max, |
| 182 | + NULL::bigint AS compressed_batch_rows_avg, |
| 183 | + NULL::double precision AS compressed_batch_rows_stddev, |
| 184 | + NULL::bigint AS compressed_batch_bytes_min, |
| 185 | + NULL::bigint AS compressed_batch_bytes_max, |
| 186 | + NULL::bigint AS compressed_batch_bytes_avg, |
| 187 | + NULL::double precision AS compressed_batch_bytes_stddev, |
| 188 | + NULL::bigint AS compressed_block_bytes_min, |
| 189 | + NULL::bigint AS compressed_block_bytes_max, |
| 190 | + NULL::bigint AS compressed_block_bytes_avg, |
| 191 | + NULL::double precision AS compressed_block_bytes_stddev, |
| 192 | + NULL::bigint AS total_batches_deleted, |
| 193 | + NULL::bigint AS total_batches_decompressed, |
| 194 | + NULL::bigint AS total_tuples_decompressed, |
| 195 | + NULL::bigint AS total_batches_scanned, |
| 196 | + NULL::bigint AS total_batches_checked_by_bloom, |
| 197 | + NULL::bigint AS total_batches_pruned_by_bloom, |
| 198 | + NULL::bigint AS total_batches_without_bloom, |
| 199 | + NULL::bigint AS total_batches_bloom_false_positives, |
| 200 | + NULL::bigint AS total_batches_filtered_compressed, |
| 201 | + NULL::bigint AS total_batches_filtered_decompressed, |
| 202 | + NULL::bigint AS last_op_batches_deleted, |
| 203 | + NULL::bigint AS last_op_batches_decompressed, |
| 204 | + NULL::bigint AS last_op_tuples_decompressed, |
| 205 | + NULL::bigint AS last_op_batches_scanned, |
| 206 | + NULL::bigint AS last_op_batches_checked_by_bloom, |
| 207 | + NULL::bigint AS last_op_batches_pruned_by_bloom, |
| 208 | + NULL::bigint AS last_op_batches_without_bloom, |
| 209 | + NULL::bigint AS last_op_batches_bloom_false_positives, |
| 210 | + NULL::bigint AS last_op_batches_filtered_compressed, |
| 211 | + NULL::bigint AS last_op_batches_filtered_decompressed, |
| 212 | + NULL::bigint AS n_selects, |
| 213 | + NULL::bigint AS n_inserts, |
| 214 | + NULL::bigint AS n_updates, |
| 215 | + NULL::bigint AS n_deletes, |
| 216 | + NULL::timestamptz AS first_update, |
| 217 | + NULL::timestamptz AS last_update; |
| 218 | + |
0 commit comments