-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix row comparison operator in event triggers (fix #2036) #2868
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 row comparison operator in event triggers (fix #2036) #2868
Conversation
|
Deploy preview for hasura-docs ready! Built with commit 711cf97 |
|
Review app for commit 9241785 deployed to Heroku: https://hge-ci-pull-2868.herokuapp.com |
|
Review app for commit 711cf97 deployed to Heroku: https://hge-ci-pull-2868.herokuapp.com |
|
Review app https://hge-ci-pull-2868.herokuapp.com is deleted |
| PERFORM hdb_catalog.insert_event_log(CAST(TG_TABLE_SCHEMA AS text), CAST(TG_TABLE_NAME AS text), CAST('{{NAME}}' AS text), TG_OP, _data); | ||
| END IF; | ||
| BEGIN | ||
| IF (TG_OP <> 'UPDATE') OR (_old <> _new) THEN |
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.
Wouldn't it be more performant if we did a check like the following:
IF (TG_OP <> 'UPDATE') THEN
insert_event_log
ELSE
BEGIN
IF (_old <> new) THEN
insert_event_log
EXCEPTION WHEN undefined_function THEN
IF (_old *<> new) THEN
insert_event_log
…ra#2868) Update trigger is failing if any json/geometry columns are present in event payload rows. Use '*<>' operator instead of '<>' to compare the internal binary representation of rows if '<>' doesn’t work.
Description
Event triggers are failing if a table contains columns with json/geometry type. It is due to the limitation of the comparison operator (
<>) in the trigger definition.Affected components
Related Issues
fix #2036
Solution and Design
Use composite comparison operator
*<>, which compares the internal binary representation of two rows.Steps to test and verify
Follow the reproduction guide given in issue #2036