-
Notifications
You must be signed in to change notification settings - Fork 79
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
Handling PG exceptions #193
Comments
@bf4 Could you, please, clarify the "without failing the transaction"? Do you want a trigger function to quietly fail (and log the error somehow) even if the log entry hasn't been created? How would this affect the consistency of data? |
re: "without failing the transaction" It's my understanding that a function with raises an exception, whether it's a before or after trigger, causes the entire transaction to fail. @palkan I have two ideas here
either can be configured to take the name of a function and pass in args to it, or just be expected to be redefinable by the user |
Yeah, we though about similar: defining a blank (or re-raising)
I like it. We can extract diff-to-jsonb conversion into a separate function (oh no, one more function 🤯) and implement a fallback within it. So instead of logidze/lib/generators/logidze/install/functions/logidze_logger.sql Lines 91 to 97 in 3521c5f
We gonna use: IF (coalesce(current_setting('logidze.full_snapshot', true), '') = 'on') THEN
changes = logidze_diff_to_jsonb(NEW.*);
ELSE
changes = logidze_diff_to_jsonb(NEW.*, OLD.*);
END IF; @skryukov WDYT? |
From #69:
The text was updated successfully, but these errors were encountered: