-
Notifications
You must be signed in to change notification settings - Fork 94
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
Feature: has_trigger_events() #337
Comments
This seems like it would be a useful function to complement SELECT trigger_events_are ( :schema, :table, :events, :description );
SELECT trigger_events_are ( :schema, :table, :events );
SELECT trigger_events_are ( :table, :events, :description );
SELECT trigger_events_are ( :table, :events ); To add those functions to the project, append them to |
@theory thanks for the advice how to add this. Yes, you're right, naming I'll create a PR once I have this ready. At the moment, I'm not sure why my tests are failing. I have to check this. Or do you have an idea what I'm doing wrong? If I'm running ... other tests are passing
ruletap ... ok 17680 ms
resultset ... ok 8918 ms
util ... ok 2125 ms
policy ... ok 4164 ms
trigger ... FAILED 3666 ms
istap ... ok 2536 ms
=======================
1 of 39 tests failed.
=======================
The differences that caused some tests to fail can be viewed in the
file "/home/alexander/awolf81-fork-pgtap/regression.diffs". A copy of the test summary that you see
above is saved in the file "/home/alexander/awolf81-fork-pgtap/regression.out".
make: *** [/usr/lib/postgresql/12/lib/pgxs/src/makefiles/pgxs.mk:420: installcheck] Error 1 And the
Running the pg_prove -d regression test/sql/trigger.sql
test/sql/trigger.sql .. ok
All tests successful.
Files=1, Tests=97, 1 wallclock secs ( 0.19 usr 0.03 sys + 0.35 cusr 0.17 csys = 0.74 CPU)
Result: PASS |
Yeah you added new tests so you have to update cp results/trigger.out test/expected/trigger.out Sorry for the delayed reply, was completely absorbed in writing a couple conference presentations for the last few weeks. |
@AWolf81 as you I need a function to check event_trigger, what are your plans regarding what you've already done ? Do you think to push a pull request in the following days/weeks ? |
@rodo sorry, not much progress here. I've changed the naming to Things that are open:
|
Ok, thanks for your quick answer @AWolf81 I'll have a look in the following days. |
I'm pretty new to pgTAP but I think there is no easy way to check if a trigger event is avaliable at a given table.
rules_are
is similar but that's not working for triggers.The line in question of a schema that the function will test is marked in the below example definition:
CREATE TRIGGER test_trigger
AFTER INSERT OR UPDATE ON test_table
FOR EACH ROW
EXECUTE FUNCTION test_trigger_function();
So the idea is to add a
has_trigger_events
function.I think the following code is exactly implementing that function:
I haven't checked how to add it to pgTAP but if there is a guide on how to contribute, I could create a PR if this feature is interesting for pgTAP.
If this function is not interesting, that's also no problem.
The tests above are covering all cases.
Topics not covered in the function
has_trigger_events
, would be possible but makes thehas_trigger_events
usage more complicated. Maybe this would be better to add as additional test function.FOR EACH ROW
not covered inhas_trigger_events
- would be better in a separatehas_trigger_definition
functionhasnt_trigger_events
not added yet - is it needed? How to add without duplicating thehas_trigger_events
logic e.g. refactor/rename tocheck_trigger_events
and add an arg.p_check_presence
to check has or hasn't based on it.The mentioned missing parts would be nice to have but I think they're all optional.
The text was updated successfully, but these errors were encountered: