Re: Re: postgresql notifications
"Billy G. Allie" <[email protected]>
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Organization | michigan!/usr/group |
| Message-ID | <[email protected]> |
Gerhard Häring wrote: > [Cc-ed to pypgsql-users - I'd recommend to take this discussion over > there] > > Witek wrote: > >> Gerhard Häring wrote: >> >>>> I'm using pypgsql to connect to postgresql database (7.2, 7.3). >>>> I recieve PgNotify object using notifies() method of connection >>>> object, but it's fields values are random chars and wrong process >>>> id. Is there someone, who put it to work? >>> >>> >>> The pyPgSQL source distribution includes examples for notifications >>> (examples/demo2a.py, examples/demo2b.py). >>> Please report back if you still have problems. >> >> >> They are not working under Linux or Windows. I tried examples from >> gnumed project as well. > > > They did certainly work for me last time I checked. > > Do you have different versions of the PostgreSQL client library and > the server? If for example you use a 7.3 client and a 7.2 server there > might be some problems ... Just a rough guess of me of course. > > -- Gerhard It was working the last time I checked, but it's not working now :-( I've update the CVS repository with a fixed pgnotify.c that will correct the problem. I am also attaching a patch file to correct the problem. -- ___________________________________________________________________________ ____ | Billy G. Allie | Domain....: [email protected] | /| | 7436 Hartwell | MSN.......: [email protected] |-/-|----- | Dearborn, MI 48126| |/ |LLIE | (313) 582-1540 |
pgnotify.patch
(text/plain, 1.1 KB)
*** pgnotify.c 6 Sep 2001 04:42:21 -0000 1.6
--- pgnotify.c 29 May 2003 01:39:21 -0000 1.7
***************
*** 29,34 ****
--- 29,36 ----
| |
| Date Ini Description |
| --------- --- ------------------------------------------------------- |
+ | 28MAY2002 bga Fixed a bug in the code. The code in question use to |
+ | work, but doesn't anymore (possible change to libpq?). |
| 06SEP2001 bga Clarified an embedded assignment within an if test. |
| 30AUG2001 bga Use PyObject_Del() instead of PyMem_Free() in dealloc() |
| to delete the object. |
***************
*** 63,69 ****
else if ((self = (PgNotify *)PyObject_New(PgNotify, &PgNotify_Type)) !=
(PgNotify *)NULL)
{
! self->relname = Py_BuildValue("s", &(note->relname));
self->be_pid = Py_BuildValue("i", note->be_pid);
free(note);
if (PyErr_Occurred())
--- 65,71 ----
else if ((self = (PgNotify *)PyObject_New(PgNotify, &PgNotify_Type)) !=
(PgNotify *)NULL)
{
! self->relname = Py_BuildValue("s", note->relname);
self->be_pid = Py_BuildValue("i", note->be_pid);
free(note);
if (PyErr_Occurred())