electric-sql / electric-sql/pglite

JS can only listen to lower-case event channels

Open
#642 3 comments 0 reactions 1 assignee Claimed by @tdrz View on GitHub
documentation
Dominant language
TypeScript
Stars
16k
Forks
442
Avg merge
20h 19m
Merged PRs (30d)
7

Description

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...

https://github.com/electric-sql/pglite/blob/71707ff970508fa1f8db6ed1d170f31194bf89e6/packages/pglite/src/utils.ts#L241-L242

...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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.