-
Notifications
You must be signed in to change notification settings - Fork 14
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
Replace source using UPDATE pg_proc #39
Comments
In case anyone was thinking of implementing things this way, I'll +1 the idea to use pg_get_functiondef. Note it can be difficult to work with, but something like the following should work:
Note you can adjust or omit the bits of the where clause to get different results back. Hope this helps! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current method of replacing an existing function with an instrumented uses
CREATE OR REPLACE FUNCTION
. Since we don't save all the metadata likeCOST
or other attributes, those can be removed on the instrumented version, and won't be restored withpiggly untrace
. This approach also requires recording parameter names, defaults, and other parts of the function signature so that we can properly redefine the function.It seems like there's a simpler way to do this, which avoids those problems.
This preserves any parameter names, cost annotations, and other attributes and might also avoid other problems. Some work is needed to ensure this won't cause other issues. For example, if we only store the OID and the source, what do we do if the UPDATE statement doesn't update any rows (presumably the user replaced the proc since we last looked)?
The text was updated successfully, but these errors were encountered: