-
Notifications
You must be signed in to change notification settings - Fork 893
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
Fix cagg trigger on compat schema layer #6163
Fix cagg trigger on compat schema layer #6163
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6163 +/- ##
==========================================
- Coverage 81.46% 81.41% -0.06%
==========================================
Files 246 246
Lines 56974 56928 -46
Branches 12624 12605 -19
==========================================
- Hits 46414 46347 -67
+ Misses 8180 8171 -9
- Partials 2380 2410 +30 see 45 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
7d34107
to
7afecb4
Compare
bba749d
to
3131231
Compare
Not a fan of this, this trigger should never be called through compat layer unless your database is already broken |
We're mapping to C function directly already in this PR: https://github.com/timescale/timescaledb/pull/6163/files#diff-8943dabbdc6a8f1b136468c00599f91c6f615869a324b0de70b9c7614a77c9bfR191-R192 The only additional code is just to emit the WARNING message because the current form is wrong: https://github.com/timescale/timescaledb/blob/main/sql/compat.sql#L192-L199 |
Chatting with @svenklemm we agreed that is better to don't add extra C code to emit the warning and just point the deprecated schema to the new one and adding regression test to make sure it is working. /cc @jnidzwetzki |
d394055
to
3f6ba92
Compare
The trigger `continuous_agg_invalidation_trigger` receive the hypertable id as parameter as the following example: Triggers: ts_cagg_invalidation_trigger AFTER INSERT OR DELETE OR UPDATE ON _timescaledb_internal._hyper_3_59_chunk FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.continuous_agg_invalidation_trigger('3') The problem is in the compatibility layer using PL/pgSQL code there's no way to passdown the parameter from the wrapper trigger function created to the underlying trigger function in another schema. To solve this we simple create a new function in the deprecated `_timescaledb_internal` schema pointing to the function trigger and inside the C code we emit the WARNING message if the function is called from the deprecated schema.
3f6ba92
to
8702f4e
Compare
The trigger
continuous_agg_invalidation_trigger
receive the hypertableid as parameter as the following example:
The problem is in the compatibility layer using PL/pgSQL code there's no
way to passdown the parameter from the wrapper trigger function created
to the underlying trigger function in another schema.
To solve this we simple create a new function in the deprecated
_timescaledb_internal
schema pointing to the function trigger andinside the C code we emit the WARNING message if the function is called
from the deprecated schema.
Disable-check: force-changelog-file