Req #68199 [Asn]: Payload in NOTIFY is not supported
| From: | mbeccati@php.net | Date: | Fri, 17 Oct 2014 13:44:16 +0000 |
| Subject: | Req #68199 [Asn]: Payload in NOTIFY is not supported | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188163@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68199&edit=1
ID: 68199
Updated by: mbeccati@php.net
Reported by: alain dot laporte12345 at gmail dot com
Summary: Payload in NOTIFY is not supported
Status: Assigned
Type: Feature/Change Request
Package: PDO PgSQL
Operating System: Linux (ArchLinux)
PHP Version: 5.6.1
Assigned To: mbeccati
Block user comment: N
Private report: N
New Comment:
Thanks for reporting. I would actually categorize this as a bug, as I've mistakenly left it out
when adding pgsqlGetNotify in 5.6.0. I guess it would be safe to try and fix it for 5.6.2 and
accordingly update the manual entry. Thoughts?
Previous Comments:
------------------------------------------------------------------------
[2014-10-17 13:22:38] tyrael@php.net
Matteo, any chance you could look into this?
------------------------------------------------------------------------
[2014-10-09 12:54:20] alain dot laporte12345 at gmail dot com
Description:
------------
Since PostgreSQL 9.0, NOTIFY command accept a payload => http://www.postgresql.org/docs/9.0/static/sql-notify.html
The payload is available in the libpq's structure pgNotify.extra => http://www.postgresql.org/docs/9.0/static/libpq-notify.html
This field is available since PostgreSQL 7.4, but is empty until PostgreSQL 9.0 => http://www.postgresql.org/docs/7.4/static/libpq-notify.html
I provide a patch for PDO::pgsqlGetNotify() method which work for me. But I doubt which my check
about libpq version is comply with the good practice.
Test script:
---------------
<?php
$dsn = 'pgsql:host=localhost;port=5432;dbname=postgres;user=admin;password=toto';
$db = new PDO($dsn);
$db->exec('LISTEN event;');
$db->exec('NOTIFY event, \'payload\';');
var_dump($db->pgsqlGetNotify());
?>
Expected result:
----------------
array(6) {
[0]=>
string(5) "event"
[1]=>
int(25876)
[2]=>
string(7) "payload"
["message"]=>
string(5) "event"
["pid"]=>
int(25876)
["payload"]=>
string(7) "payload"
}
Actual result:
--------------
array(4) {
[0]=>
string(5) "event"
[1]=>
int(25876)
["message"]=>
string(5) "event"
["pid"]=>
int(25876)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68199&edit=1