Search Postgresql Archives

Re: Example 31-2. libpq Example Program 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, March 10, 2021, Niko Ware <nikowareinc@xxxxxxxxx> wrote:


I modified the code to include the "extra" member in the following statement:

fprintf(stderr,
                    "ASYNC NOTIFY of '%s' received from backend PID %d: %s\n",
                    notify->relname, notify->be_pid, notify->extra);

I was unable to locate any example of how to retrieve the payload in C. 


Since psql does it correctly that is a good place to find code.

https://github.com/postgres/postgres/blob/3f0daeb02f8dd605f89de9aa2349137c09cc7fb4/src/bin/psql/common.c#L689

Yes, your modification should work.  Looking at the history that extra field is 18 years old. I’m not in a position to confirm whether or not this is somehow broken on head but has gone undiscovered, but it seems unlikely.  Only advice I can think of besides waiting for a more experienced hacker is to check the relevant header files and breakpoint/trace the code and see what “notify” actually looks like.  Or start from scratch on a clean setup and try again confirming you have checked out master/head from the official repository.

David J.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux