-
Notifications
You must be signed in to change notification settings - Fork 7.8k
pgsqlSetNoticeCallback #6764
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
pgsqlSetNoticeCallback #6764
Conversation
@outtersg you might want to rebase here so the PR can be merged. The appveyor build also seems to fail. |
50ccdd8
to
dbae1c6
Compare
Thanks @driesvints for mentionning it… I did not even noticed I wasn't notified of my own PR's status changes. |
dbae1c6
to
9c4507e
Compare
Is this PR still active? |
@HellLeaf wrote:
Yes, I ensure it still compiles (with PHP 8.1.2); |
Sorry for the long reply, could you possibly rebase against the current master please ? thanks. |
9c4507e
to
37968cd
Compare
520e829
to
c89544e
Compare
@devnexen wrote:
And here it is; |
Thanks I ll have a look later this week, at first glance looking good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good but will wait a bit before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things about the code don't seem 100% right. Please also test this with a Closure object and a trampoline.
Thank you @nielsdos for your invaluable review! I started this as an amateur quick way of implementing my need, with zero knowledge of the PHP coding best practices (and in fact no intelligence at all in the code: most of it is a big copy-paste-adapt of some other ext where I found callback use, from a PHP 5.3 source tree). So your detailed review with tips on exactly how to converge to a clean solution is really welcome for the newby I am here. I'm wondering with your:
that I'm not familiar at all with. Would you please point me to a test sample of a trampoline callback I could elaborate upon? I'll try to digest and apply all you recommendations, but it will take me some time (and probably many IC failures) before something polished emerges here. |
Please see
When you have a class with the __call magic function, you can create a "trampoline" by creating a callable to any name that is not a method already on the class. E.g. on line 18 of that test, a callable to the authorizer function of that class is made which will implicitly call the __call function. Internally this kind of callable is known as a trampoline because the engine needs an extra step.
The commit that added the test also has some code for the "F" ZPP modifier.
No worries! In any case, if you're stuck or have questions just ping us 🙂 |
Allows a callback to be triggered on every notice sent by PostgreSQL. Such notices can be sent with a RAISE NOTICE in PL/pgSQL; in a long running stored procedure, they prove useful as realtime checkpoint indicators.
Make the dirty casting work inside our callback, not while interacting with libpq's functions
use standard macros & funcs php#6764 (review)
a8edab4
to
3d4d448
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much much better! Thanks!
I have some review comments, but the hard part of the work is over :)
Thanks @nielsdos for your second, exhaustive review (and your responsiveness)! Your advice made a monstrously satisfying simplification and clarification to the whole thing. Three notes:
|
You're welcome!
No need to worry about the history. We will do the squash upon merging.
Replied on your comment 🙂
That's fine, it makes sense. |
9a55b89
to
7d2c13c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work! Looks good to me.
@devnexen Want to have a final sanity check and take it from here?
Thanks I ll have a last look tomorrow :) |
7d2c13c
to
b0df768
Compare
Thanks for your work ! |
@outtersg Was the new method intentionally not added to the new |
@kocsismate wrote:
:-\ I started this closely following pgsqlCopyFromArray (available but undocumented), and I didn't think to check if anything had changed regarding the exposition points of all those semi-public functions. … But nothing is unchangeable, see #14299. |
Make the newly implemented setNoticeCallback() officially exposed (php#6764)
Make the newly implemented setNoticeCallback() officially exposed (php#6764)
Make the newly implemented setNoticeCallback() officially exposed (php#6764)
Make the newly implemented setNoticeCallback() officially exposed (php#6764)
Make the newly implemented setNoticeCallback() officially exposed (php#6764)
Make the newly implemented setNoticeCallback() officially exposed (php#6764)
Make the newly implemented setNoticeCallback() officially exposed (php#6764)
Make the newly implemented setNoticeCallback() officially exposed (php#6764)
Make the newly implemented setNoticeCallback() officially exposed (php#6764)
Allows a callback to be triggered on every notice sent by PostgreSQL.
Such notices can be sent with a RAISE NOTICE in PL/pgSQL; in a long running
stored procedure, they prove useful as realtime checkpoint indicators.
Originally proposed at https://bugs.php.net/78621