Skip to content

JS can only listen to lower-case event channels #642

Open
@jamesgpearce

Description

@jamesgpearce

Consider a trigger function that broadcasts to a channel with uppercase letters in it:

eg:

...PERFORM pg_notify('TinyBase', 'hello')...

Now try and listen to it with the pglite sdk:

await pglite.listen('TinyBase', listener);

Aaaand confusingly nothing happens. Because according to...

// Postgres case insensitive - all to lower
output = input.toLowerCase()

...PG is case insensitive. I'm not sure about that (since I think it depends on how things are quoted) but apparently certainly not for event channels notified like this!

Convert the pg_notify string to lower case and it works great. But I don't think the same problem exists in other SDKs - certainly not postgres.js at least.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions