pgnotify icon indicating copy to clipboard operation
pgnotify copied to clipboard

Add notify method

Open leodaher opened this issue 6 years ago • 1 comments

This patch adds a method for sending a PostgreSQL notify with a payload to a specific channel.

leodaher avatar Aug 26 '19 16:08 leodaher

Thank you kindly for this PR! Definitely a much-needed addition to this library.

Some things will need changing before we merge:

  • The current implementation is vulnerable to SQL injection (as mentioned by @madsmtm)
  • The cursor needs proper cleanup (probably with a with as per http://initd.org/psycopg/docs/usage.html)
  • As the docs and @prankymat mention, the pg_notify( function is probably nicer than the keyword style so let's change to that.
  • I'd rather the tests did a real test with a temporary database rather than mocking (this isn't essential, so we can probably change this in the future/a separate PR/whatever).

djrobstep avatar Sep 09 '19 06:09 djrobstep