Skip to content
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

sql.notify not available in transaction context #611

Closed
santicalcagno opened this issue Jun 9, 2023 · 1 comment
Closed

sql.notify not available in transaction context #611

santicalcagno opened this issue Jun 9, 2023 · 1 comment

Comments

@santicalcagno
Copy link

Basically this:

sql.notify('test'); // works
sql.begin(sql => {
  sql.notify('test')  // throws Uncaught TypeError: sql.notify is not a function
}}

Is that expected behavior? I am under the impression that NOTIFY should work in a transaction context as per the docs.

As a workaround I think sql.unsafe works.

Coincidentally, I think the same applies to sql.listen, although I only have a use case for .notifying in transactions.

PS: Thanks for this library! ❤️

@porsager
Copy link
Owner

porsager commented Jun 26, 2023

Oh that's a good catch. Thank you!

sql.listen won't work cause it's using a dedicated connection for that, but sql.notify should work with the transaction instance as well.

And than you for the kind words ;)

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