Change notify schema - #2
Merged
Merged
Conversation
A listener could not tell two tables of the same name apart, which is the ordinary case once a service creates schemas of its own. The payload now carries TG_TABLE_SCHEMA alongside the table. Installation follows: a model may name its schema as schema.Table, triggers are created schema-qualified, and reconciliation is confined to the schemas the desired set mentions — otherwise a service installing per tenant schema would tear down its own work on the next start.
A forty-thousand-row import emitted forty thousand payloads through one notification queue, to tell listeners something they would rather hear once. The trigger now returns early while imq.notify_suppressed is on, and withoutChangeNotify() runs a transaction with it SET LOCAL. Deliberately not session_replication_role, which switches off foreign-key enforcement as well: a bulk load run under it commits orphan rows.
imq.notify_suppressed said little in a SET LOCAL and repeated 'notify' from the prefix. It is record_change_notify.suppressed now, matching the channel, trigger and function names it belongs with.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Enhances change-notify triggers to include schema information in notifications, allowing tables with the same name in different schemas to be distinguished. Adds
withoutChangeNotify()for bulk write operations to suppress per-row notifications and prevent queue flooding. Makes trigger reconciliation schema-aware so per-tenant services can manage triggers independently.Type of change
Checklist
npm test).Contribution terms (required)
I grant the project owner the right to license my contribution
commercially, royalty-free, my contribution stays available under
GPL-3.0, I keep my copyright, and I understand I will receive no fee for
it. If I did not agree, I would not be submitting this contribution.