When I execute PERFORM pg_notify('channel', 'payload'); I get the following error:
ERROR: syntax error at or near "PERFORM"
LINE 1: PERFORM pg_notify('channel', 'payload');
^
What am I doing wrong?
The SELECT counterpart works, but I'm looking for a no-result equivalent. And I'm using psql (9.5.3, server 9.5.0).
The problem here relies on the fact that PERFORM can not be executed directly within the prompt. As the documentation says:
Sometimes it is useful to evaluate an expression or SELECT query but discard the result, for example when calling a function that has side-effects but no useful result value. To do this in PL/pgSQL, use the PERFORM statement:
It's a little bit tricky but PERFORM can only be used in a PL/pgSQL context (functions, stored procedures and stuff). And I was trying to execute it directly in the prompt which is not supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With