Req #68199 [Opn]: Payload in NOTIFY is not supported
| From: | tyrael@php.net | Date: | Fri, 17 Oct 2014 13:22:38 +0000 |
| Subject: | Req #68199 [Opn]: Payload in NOTIFY is not supported | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188162@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: tyrael@php.net
Reported by: alain dot laporte12345 at gmail dot com
Summary: Payload in NOTIFY is not supported
Status: Open
Type: Feature/Change Request
Package: PDO PgSQL
Operating System: Linux (ArchLinux)
PHP Version: 5.6.1
-Assigned To:
+Assigned To: mbeccati
Block user comment: N
Private report: N
New Comment:
Matteo, any chance you could look into this?
Previous Comments:
------------------------------------------------------------------------
[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