Add warning to event trigger
This commit is contained in:
parent
5b95cfddf4
commit
eefb16763e
1 changed files with 16 additions and 8 deletions
|
|
@ -25,6 +25,9 @@ $$
|
||||||
DECLARE
|
DECLARE
|
||||||
old_search_path text;
|
old_search_path text;
|
||||||
BEGIN
|
BEGIN
|
||||||
|
-- Only need to refresh query strings if an object is renamed.
|
||||||
|
-- As a rough heuristic, check if this is an ALTER command.
|
||||||
|
IF tg_tag LIKE 'ALTER %' THEN
|
||||||
-- Empty search path so that get_immv_def returns a fully-qualified query.
|
-- Empty search path so that get_immv_def returns a fully-qualified query.
|
||||||
SELECT setting INTO old_search_path FROM pg_catalog.pg_settings
|
SELECT setting INTO old_search_path FROM pg_catalog.pg_settings
|
||||||
WHERE name = 'search_path';
|
WHERE name = 'search_path';
|
||||||
|
|
@ -36,6 +39,11 @@ BEGIN
|
||||||
IF old_search_path != '' AND old_search_path != '""' THEN
|
IF old_search_path != '' AND old_search_path != '""' THEN
|
||||||
EXECUTE format('SET search_path = %s', old_search_path);
|
EXECUTE format('SET search_path = %s', old_search_path);
|
||||||
END IF;
|
END IF;
|
||||||
|
END IF;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN internal_error THEN
|
||||||
|
RAISE WARNING 'pg_ivm could not refresh the pg_ivm_immv query strings.'
|
||||||
|
USING HINT = 'Please recreate your IMMVs using pgivm.recreate_all_immvs().';
|
||||||
END
|
END
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue