-
Notifications
You must be signed in to change notification settings - Fork 882
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
Add hypercore chunk tests for triggers #7483
base: main
Are you sure you want to change the base?
Conversation
Add tests for statement and row triggers on hypercore chunks. We test `INSERT`, `UPDATE`, `DELETE`, and `TRUNCATE` triggers, where applicable. We check that the `OLD` and `NEW` values are correct as well as that the statement and row triggers are executed the correct number of times.
1a7f4b1
to
1510ded
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7483 +/- ##
==========================================
+ Coverage 80.06% 82.12% +2.06%
==========================================
Files 190 230 +40
Lines 37181 43129 +5948
Branches 9450 10846 +1396
==========================================
+ Hits 29770 35421 +5651
- Misses 2997 3388 +391
+ Partials 4414 4320 -94 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
@gayyappan, @erimatnor: please review this pull request.
|
create function save_insert_row() returns trigger as $$ | ||
begin | ||
insert into saved_rows select new.*, true, 'insert'; | ||
return new; | ||
end; | ||
$$ language plpgsql; | ||
|
||
create function save_update_row() returns trigger as $$ | ||
begin | ||
insert into saved_rows select new.*, true, 'update'; | ||
insert into saved_rows select old.*, false, 'update'; | ||
return new; | ||
end; | ||
$$ language plpgsql; | ||
|
||
create function save_delete_row() returns trigger as $$ | ||
begin | ||
insert into saved_rows select old.*, false, 'delete'; | ||
return new; | ||
end; | ||
$$ language plpgsql; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be simplified in only one trigger function and also track TG_WHEN
and use TG_OP
to save the proper operation on the saved_rows
table.
Another thing is that you're testing only BEFORE
triggers and what about AFTER
and INSTEAD OF
??
Add tests for statement and row triggers on hypercore chunks. We test
INSERT
,UPDATE
,DELETE
, andTRUNCATE
triggers, where applicable. We check that theOLD
andNEW
values are correct as well as that the statement and row triggers are executed the correct number of times.Disable-check: force-changelog-file