Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions sql/timeseries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,15 @@ BEGIN
RETURN;
END IF;

-- make sure we have the expected columnar extension available
IF NOT _extension_exists('citus_columnar') THEN
RAISE NOTICE object_not_in_prerequisite_state USING
MESSAGE = 'Cannot apply compression policy',
DETAIL = 'The citus_columnar extension is required to apply a compression policy',
HINT = 'Did you forget to run "CREATE EXTENSION citus_columnar" ?';
RETURN;
END IF;

SELECT format('%s.%s', n.nspname, c.relname)
INTO table_name
FROM pg_class c
Expand Down Expand Up @@ -652,6 +661,15 @@ DECLARE
old_client_msg text;
old_log_msg text;
BEGIN

-- make sure we have the expected pg_ivm extension available
IF NOT _extension_exists('pg_ivm') THEN
RAISE NOTICE object_not_in_prerequisite_state USING
MESSAGE = 'Cannot create incremental view',
DETAIL = 'The pg_ivm extension is required to create incremental views with pg_timeseries',
HINT = 'Did you forget to run "CREATE EXTENSION pg_ivm" ?';
RETURN;
END IF;
-- check that target_view_id is actually a view
-- check that target_view_id mentions only one table

Expand Down Expand Up @@ -692,3 +710,14 @@ BEGIN
target_view_id, columns_sql, immv_name);
END;
$function$;

CREATE FUNCTION @extschema@._extension_exists(extension_name TEXT)
RETURNS BOOLEAN
LANGUAGE SQL
AS $function$
SELECT EXISTS (
SELECT 1
FROM pg_extension
WHERE extname = extension_name
)
$function$;