Skip to content

Change notify schema - #2

Merged
SerhiyGreench merged 3 commits into
masterfrom
change-notify-schema
Aug 27, 2026
Merged

Change notify schema#2
SerhiyGreench merged 3 commits into
masterfrom
change-notify-schema

Conversation

@SerhiyGreench

@SerhiyGreench SerhiyGreench commented Aug 27, 2026

Copy link
Copy Markdown
Member

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

  • Bug fix
  • New feature
  • Documentation
  • Refactor / internal
  • Other:

Checklist

  • I have read the Contributing guide.
  • Tests added or updated, and the full suite passes locally (npm test).
  • Docs / doc-blocks updated where relevant.
  • The PR is focused on a single logical change.

Contribution terms (required)

  • I have read and agree to the @imqueue Contribution Terms.
    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.

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.
@SerhiyGreench
SerhiyGreench merged commit 69aff0b into master Aug 27, 2026
10 of 17 checks passed
@SerhiyGreench
SerhiyGreench deleted the change-notify-schema branch August 27, 2026 11:14
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant