pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #13994: Documentation of pg_notify is incorrect.
3+ messages / 3 participants
[nested] [flat]

* BUG #13994: Documentation of pg_notify is incorrect.
@ 2016-02-28 23:20 junkmesend@gmail.com
  2016-02-28 23:37 ` Re: BUG #13994: Documentation of pg_notify is incorrect. David Gould <daveg@sonic.net>
  2016-02-28 23:43 ` Re: BUG #13994: Documentation of pg_notify is incorrect. Joe Conway <mail@joeconway.com>
  0 siblings, 2 replies; 3+ messages in thread

From: junkmesend@gmail.com @ 2016-02-28 23:20 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      13994
Logged by:          Peter McGeeney
Email address:      junkmesend@gmail.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

Please note that this is nothing to do with the uppercase issue with
pg_notify here...

http://www.postgresql.org/message-id/201103031520.p23FKxFJ049037@wwwmaster.postgresql.org

Many thanks

Pete


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #13994: Documentation of pg_notify is incorrect.
  2016-02-28 23:20 BUG #13994: Documentation of pg_notify is incorrect. junkmesend@gmail.com
@ 2016-02-28 23:37 ` David Gould <daveg@sonic.net>
  1 sibling, 0 replies; 3+ messages in thread

From: David Gould @ 2016-02-28 23:37 UTC (permalink / raw)
  To: junkmesend@gmail.com; +Cc: pgsql-bugs

On Sun, 28 Feb 2016 23:20:40 +0000
junkmesend@gmail.com wrote:

> The following bug has been logged on the website:
> 
> Bug reference:      13994
> Logged by:          Peter McGeeney
> Email address:      junkmesend@gmail.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@sonic.net
If simplicity worked, the world would be overrun with insects.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #13994: Documentation of pg_notify is incorrect.
  2016-02-28 23:20 BUG #13994: Documentation of pg_notify is incorrect. junkmesend@gmail.com
@ 2016-02-28 23:43 ` Joe Conway <mail@joeconway.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Joe Conway @ 2016-02-28 23:43 UTC (permalink / raw)
  To: junkmesend@gmail.com; pgsql-bugs

On 02/28/2016 03:20 PM, junkmesend@gmail.com wrote:
> http://www.postgresql.org/docs/9.5/static/sql-notify.html
> 
> Recommends the command...
> 
> SELECT pg_notify('fo' || 'o', 'pay' || 'load');

Which works fine:
postgres=# SELECT pg_notify('fo' || 'o', 'pay' || 'load');
 pg_notify
-----------

(1 row)

> 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

You are confusing SQL statement syntax with PL/pgSQL function syntax. See:

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

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 835B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2016-02-28 23:43 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-02-28 23:20 BUG #13994: Documentation of pg_notify is incorrect. junkmesend@gmail.com
2016-02-28 23:37 ` David Gould <daveg@sonic.net>
2016-02-28 23:43 ` Joe Conway <mail@joeconway.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox