-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pg_listen is not working properly #23
Comments
Maybe this is just a problem of compatibility? Did you change the way to perform notifications? |
I switched back to the old version 2.0.0 and everything works as expected... |
Have you tried defining your proc as:
Using |
The problem with this suggestion is that nothing comes to |
What you're trying to do might be easier with a PL/Tcl Function defined on the database: https://www.postgresql.org/docs/9.1/static/pltcl-functions.html I don't think any of the recent changes in this Pgtcl have intentionally change the "pg_listen" functionality, as that is relatively old functionality that is not commonly used. |
I think I see a change that might have had an effect on this, where I was cleaning up error handling. |
There's a lot of changes since 2.0.0... can you try to find the most recent version in which this works, and the oldest version where it does not work, so I can look more closely? |
@resuna The version that works for me is 2.0.0. Give me some time to compile/install 2.1 and 2.2... I'll try to answer you within a couple of hours. Thanks a lot. |
@resuna , 2.3.0 version is not working properly on CentOS 7.
And the compilation passed with warnings:
Trying older versions... |
Version 2.2.0 works incorrectly.
|
The same situation with version 2.1.0
|
And a freshly built 2.0.0 works?
|
That "handle_substitutions" problem is hard to understand, did you do a new autoconf/configure after each checkout? Edit: This was fixed in 2.3.2. |
Very strange...
|
And here I am digging through the differences between 2.0.0 and 2.1.0 and finding nothing. :) Sounds like there's a change someone in the include files or compiler toolchain that's breaking things. Or Centos had some special magic in their build. That's tough to figure out. |
And I got more confused. By the way,
I'm compiling in different folders, and doing package require Pgtcl
> 2.1.0 was the one I wanted to test... |
This is what I get when I test the version that comes with CentOS 7
I see the full message that comes from PERFORM pg_notify('virtual', payload); |
V 2.0.0-alpha2 doesn't work 😮 |
check the version of libpq you’re building against? |
How to check that?
So, I'm using something that is located at |
I'm doing something like this... https://gist.github.com/rianby64/b91fb02efbfaab68492cf4dbf2388855 Hope this code may help you to understand my case. Thanks a lot! |
@bovine , I'd be happy to share with you some thoughts about your remark. set sockChan [socket localhost 9900] may fail. |
You can do anything (including socket operations) if you use a fully trusted PL/TclU |
Oh! Thanks a lot @bovine . I'll read twice before doing any new conclusion. |
I suspect that the package you got from Centos was built against libpq from postgresql 9, not 10. |
@resuna, I test the package [root@localhost /]# yum info postgresql96-tcl.x86_64
Loaded plugins: fastestmirror, remove-with-leaves, show-leaves
Loading mirror speeds from cached hostfile
* base: mirror.awanti.com
* epel: mirror.awanti.com
* extras: mirror.awanti.com
* nux-dextop: mirror.li.nux.ro
* updates: mirror.corbina.net
Available Packages
Name : postgresql96-tcl
Arch : x86_64
Version : 2.3.1
Release : 1.rhel7
Size : 336 k
Repo : pgdg96/7/x86_64
Summary : A Tcl client library for PostgreSQL
URL : https://github.com/flightaware/Pgtcl
License : BSD
Description : PostgreSQL is an advanced Object-Relational database management system.
: The tcl-pgtcl package contains Pgtcl, a Tcl client library for connecting
: to a PostgreSQL server. against Postgres9.6 and against Postgres9.2 days ago and I found the same issue. Please, check my case here:
|
That doesn't actually tell us what version of libpq you were linking against. I'm not familiar with yum's packaging for Postgres components, but that looks like a Pgtcl package for postgresql96. libpq is in the postgresql package itself. I rolled back to 1.9 and got a different error:
Does that ring any bells @bovine ? |
Nothing i recognize. |
@bovine , what's next? Should we close this issue? Looks like don't see anything unexpected in new versions of this extension. The reason why I raised this issue is simple: payload is not being passed when notifying via
|
Any new developments regarding this issue? Still, no playload gets transferred to the listening proc. |
Yesterday and today I took some time to add the channel name, the PID of the notifying backend and the payload (if present) to the callback. Luckily, changing a few lines of one file only does the trick. Apply the attached patch to the file generic/pgtclId.c and compile. The callback procedure can be defined as follows:
Hopefully, this is being incorporated into the next version of the library. |
Looking at the patch, you're creating a command using string rather than list operations. That's probably not an exploitable bug in this case, but it isn't best practice. Edit: I'm kind of busy right now but I should be able to rewrite it after next week. |
Ok, I rewrote it with a list instead of a string. Now even payloads with unbalanced braces work fine. Thanks for the idea |
Looks good, you could eliminate |
I've inserted your changes with a couple of tweaks to https://github.com/flightaware/Pgtcl/tree/pg_listen_payload |
@holgerjakobs Could you review or comment on PR#42? Also @rianby64 In particular I would like some feedback on how the callback list should be constructed in the case of a missing notify element. |
I've the following case:
And in shell, the result of doing any modification to the table, ends up with:
Looks like you removed the parameter payload from the callback.
If try the same case under CentOS 7 with
then all will work correctly.
The text was updated successfully, but these errors were encountered: