Re: BUG #13994: Documentation of pg_notify is incorrect.

From: David Gould <daveg(at)sonic(dot)net>
To: junkmesend(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13994: Documentation of pg_notify is incorrect.
Date: 2016-02-28 23:37:35
Message-ID: 20160228153735.447d9459@engels
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, 28 Feb 2016 23:20:40 +0000
junkmesend(at)gmail(dot)com wrote:

> The following bug has been logged on the website:
>
> Bug reference: 13994
> Logged by: Peter McGeeney
> Email address: junkmesend(at)gmail(dot)com
> PostgreSQL version: 9.5.1
> Operating system: Windows 8.1
> Description:
>
> The documentation at
>
> http://www.postgresql.org/docs/9.5/static/sql-notify.html
>
> Recommends the command...
>
> SELECT pg_notify('fo' || 'o', 'pay' || 'load');
>
> which doesn't work but
>
> PERFORM pg_notify('fo' || 'o', 'pay' || 'load');
>
> does work, as explained here.
>
> http://stackoverflow.com/questions/5412474/using-pg-notify-in-postgresql-trigger-function?lq=1

This is working as documented. The trigger function is using language
plpgsql, but the psql session is sql. SELECT works differently in plpgsql
than in sql. Specifically it requires a destination for the result.
Otherwise use PERFORM.

See the fine manual:

http://www.postgresql.org/docs/9.5/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-NORESULT

-dg

--
David Gould 510 282 0869 daveg(at)sonic(dot)net
If simplicity worked, the world would be overrun with insects.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Joe Conway 2016-02-28 23:43:46 Re: BUG #13994: Documentation of pg_notify is incorrect.
Previous Message junkmesend 2016-02-28 23:20:40 BUG #13994: Documentation of pg_notify is incorrect.