-
Notifications
You must be signed in to change notification settings - Fork 990
Open
Labels
Description
Relevant system information:
- OS:
macos 10.15.7 - PostgreSQL version (output of
postgres --version):12.4 - TimescaleDB version (output of
\dxinpsql):2.1.0 - Installation method:
source
Describe the bug
Event triggers aren not fired on continuous aggregate creation
To Reproduce
Steps to reproduce the behavior:
- Create an event trigger on
ddl_command_startorddl_command_end. - Create a continuous aggregate.
Expected behavior
The event trigger is fired for CREATE MATERIALIZED VIEW and is populated with the output view.
Actual behavior
The event trigger is never fired.
Screenshots
timescale=> CREATE OR REPLACE FUNCTION log_any_command()
RETURNS event_trigger
LANGUAGE plpgsql
AS $$
BEGIN
RAISE NOTICE 'command % for event %', tg_tag, tg_event;
END;
$$;
CREATE FUNCTION
timescale=> CREATE EVENT TRIGGER ddl_start ON ddl_command_start
EXECUTE FUNCTION log_any_command();
CREATE EVENT TRIGGER
timescale=> CREATE EVENT TRIGGER ddl_end ON ddl_command_end
EXECUTE FUNCTION log_any_command();
CREATE EVENT TRIGGER
timescale=> CREATE EVENT TRIGGER ddl_drop ON sql_drop
EXECUTE FUNCTION log_any_command();
CREATE EVENT TRIGGER
timescale=> CREATE EVENT TRIGGER ddl_rewrite ON table_rewrite
EXECUTE FUNCTION log_any_command();
CREATE EVENT TRIGGER
timescale=> \dx timescaledb
List of installed extensions
Name | Version | Schema | Description
-------------+---------+--------+-------------------------------------------------------------------
timescaledb | 2.1.0 | public | Enables scalable inserts and complex queries for time-series data
(1 row)
timescale=> create table foo(time timestamptz);
NOTICE: command CREATE TABLE for event ddl_command_start
NOTICE: command CREATE TABLE for event ddl_command_end
CREATE TABLE
timescale=> select create_hypertable('foo', 'time');
NOTICE: adding not-null constraint to column "time"
DETAIL: Time dimensions cannot have NULL values.
create_hypertable
-------------------
(39,public,foo,t)
(1 row)
-- no event trigger is fired when creating the continuos aggregate
timescale=> create materialized view td with (timescaledb.continuous) as
select time_bucket(interval '1 hour', time) from foo group by 1;
NOTICE: continuous aggregate "td" is already up-to-date
CREATE MATERIALIZED VIEW
-- event triggers are fired when creating a regular materialized view
timescale=> create materialized view td2 as\
select time_bucket(interval '1 hour', time) from foo group by 1;
NOTICE: command CREATE MATERIALIZED VIEW for event ddl_command_start
NOTICE: command CREATE MATERIALIZED VIEW for event ddl_command_end
SELECT 0Additional context
(log everything event trigger based on this mailing list post)
deepakagg and mavdi