Skip to content

LISTEN with a "." character #495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
darrachequesne opened this issue Oct 5, 2022 · 2 comments
Closed

LISTEN with a "." character #495

darrachequesne opened this issue Oct 5, 2022 · 2 comments

Comments

@darrachequesne
Copy link

Hi! Is it possible to listen to a channel which has a "." character in its name?

const channel = "a.b";

await sql.listen(channel, (payload) => {
  console.log(payload);
});

await sql.notify(channel, "hello");

throws Uncaught (in promise) PostgresError: syntax error at or near "."

Is there a way to escape this character?

@porsager
Copy link
Owner

porsager commented Oct 5, 2022

Hah, nice catch! That's actually my fault because I was using the identifier escape function for channel names. That is great when you want to write schema.table, but not great for channel names ;) I've fixed it, and I'll make a release with this fix this week.

Thank you!

@darrachequesne
Copy link
Author

Awesome, thanks a lot 👍

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

No branches or pull requests

2 participants