Skip to content

Match the subscribe command case-insensitively - #1327

Merged
porsager merged 1 commit into
porsager:masterfrom
efeesrefinal:fix/subscribe-event-case
Nov 20, 2026
Merged

porsager merged 1 commit into
porsager:masterfrom
efeesrefinal:fix/subscribe-event-case

Conversation

@efeesrefinal

Copy link
Copy Markdown
Contributor

parseEvent in src/subscribe.js matches the command with a case-insensitive pattern, so sql.subscribe('INSERT:users', fn) is accepted, but it keeps the command as written. The subscriber is stored under INSERT:public.users, while handle() looks events up with the lowercase command from the replication stream (insert:public.users), so the callback never runs and there is no error. With 'insert:users' it works.

The command is now lowercased when the event is parsed.

Test: subscribe with an uppercase command in tests/subscribe.js subscribes to 'INSERT:test' and inserts a row. On master it times out waiting for the row; with this change it passes, and tests/subscribe.js passes (19) against Postgres 16 with wal_level = logical. I didn't run the rest of the integration suite.

@porsager

Copy link
Copy Markdown
Owner

Thanks - that makes sense!

@porsager
porsager merged commit 492f4cc into porsager:master Nov 20, 2026
69 of 74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants