Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve arg handling in continuous_agg_trigfn #6160

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion tsl/src/continuous_aggs/insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ continuous_agg_trigfn(PG_FUNCTION_ARGS)
char *hypertable_id_str, *parent_hypertable_id_str;
int32 hypertable_id, parent_hypertable_id = 0;
bool is_distributed_hypertable_trigger = false;
if (trigdata->tg_trigger->tgnargs < 0)

if (trigdata == NULL || trigdata->tg_trigger == NULL || trigdata->tg_trigger->tgnargs < 0)
elog(ERROR, "must supply hypertable id");

hypertable_id_str = trigdata->tg_trigger->tgargs[0];
Expand Down
3 changes: 3 additions & 0 deletions tsl/test/expected/cagg_usage.out
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ SELECT relname FROM pg_class WHERE oid = :mat_table;
----------------------------------------------------------------
-- Cleanup
DROP TABLE whatever;
-- Check that continuous_agg_invalidation_trigger() handles no arguments properly
SELECT _timescaledb_functions.continuous_agg_invalidation_trigger();
ERROR: must supply hypertable id
-- END OF BASIC USAGE TESTS --
CREATE TABLE metrics(time timestamptz, device TEXT, value float);
SELECT table_name FROM create_hypertable('metrics','time');
Expand Down
3 changes: 3 additions & 0 deletions tsl/test/sql/cagg_usage.sql
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ SELECT relname FROM pg_class WHERE oid = :mat_table;
-- Cleanup
DROP TABLE whatever;

-- Check that continuous_agg_invalidation_trigger() handles no arguments properly
SELECT _timescaledb_functions.continuous_agg_invalidation_trigger();

-- END OF BASIC USAGE TESTS --

CREATE TABLE metrics(time timestamptz, device TEXT, value float);
Expand Down
Loading