You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pg.listen doesn't work if the channel name has an uppercase letter in it.
Test that reproduces this:
/** * @jest-environment node */import{PGlite}from"@electric-sql/pglite";test("can notify",async()=>{constpg=awaitPGlite.create();constf1=jest.fn(console.log);constf2=jest.fn(console.log);awaitpg.listen("test1",f1);awaitpg.listen("tesT2",f2);awaitpg.query("NOTIFY test1, 'test1'");awaitpg.query("NOTIFY tesT2, 'tesT2'");expect(f1).toHaveBeenCalled();// passes, "test1" is printedexpect(f2).toHaveBeenCalled();// fails, "tesT2" is NOT printed});
I also tried it in plain Postgres (not PGlite) and it worked, so this is definitely a bug in PGlite. It's probably due to some interaction with Postgres's case insensitivity.
I ran into this because it makes live queries not work on tables with an uppercase letter in their name, because the table name is used in the channel name and live queries are implemented with .listen. The workaround is to not use uppercase letters in your table name.
I haven't personally tested anything but a small portion of ASCII, but obviously anything that's a valid identifier should work. Here's Postgres's docs for valid characters in identifiers.
PGlite version 0.2.15
The text was updated successfully, but these errors were encountered:
pg.listen
doesn't work if the channel name has an uppercase letter in it.Test that reproduces this:
I also tried it in plain Postgres (not PGlite) and it worked, so this is definitely a bug in PGlite. It's probably due to some interaction with Postgres's case insensitivity.
plain postgres example that works as expected
I ran into this because it makes live queries not work on tables with an uppercase letter in their name, because the table name is used in the channel name and live queries are implemented with
.listen
. The workaround is to not use uppercase letters in your table name.I haven't personally tested anything but a small portion of ASCII, but obviously anything that's a valid identifier should work. Here's Postgres's docs for valid characters in identifiers.
PGlite version 0.2.15
The text was updated successfully, but these errors were encountered: