forked from postgres/postgres
-
Notifications
You must be signed in to change notification settings - Fork 3
[DNM] postgres_fdw arbitrary queries #29
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
Open
rafatower
wants to merge
10
commits into
REL_11_CARTO
Choose a base branch
from
pg_fdw_arbitrary_queries
base: REL_11_CARTO
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove SRF calls, which make actually harder to manage memory contexts, depending on the approach we take. Copy some patterns and code from dblink to achieve what we want: get an appropriate TupleDesc and TupleStore to store what we get from a sync call through libpq.
I managed to reproduce the test failure in our CI: ``` $ make check-world ... ============== running regression test queries ============== test postgres_fdw ... FAILED ============== shutting down postmaster ============== ====================== 1 of 1 tests failed. ====================== The differences that caused some tests to fail can be viewed in the file "/home/rtorre/src/postgres/pg11_build/contrib/postgres_fdw/regression.diffs". A copy of the test summary that you see above is saved in the file "/home/rtorre/src/postgres/pg11_build/contrib/postgres_fdw/regression.out". /home/rtorre/src/postgres/pg11_build/../src/makefiles/pgxs.mk:412: recipe for target 'check' failed make[2]: *** [check] Error 1 make[2]: Leaving directory '/home/rtorre/src/postgres/pg11_build/contrib/postgres_fdw' Makefile:93: recipe for target 'check-postgres_fdw-recurse' failed make[1]: *** [check-postgres_fdw-recurse] Error 2 make[1]: Leaving directory '/home/rtorre/src/postgres/pg11_build/contrib' GNUmakefile:70: recipe for target 'check-world-contrib-recurse' failed make: *** [check-world-contrib-recurse] Error 2 ``` By looking at the diffs: ``` $ cat /home/rtorre/src/postgres/pg11_build/contrib/postgres_fdw/regression.diffs *** /home/rtorre/src/postgres/pg11_build/../contrib/postgres_fdw/expected/postgres_fdw.out 2019-10-25 15:12:57.866375535 +0200 --- /home/rtorre/src/postgres/pg11_build/contrib/postgres_fdw/results/postgres_fdw.out 2019-10-28 12:41:04.876038961 +0100 *************** *** 8816,8822 **** AS t(role_name name); role_name ----------- ! postgres (1 row) -- Select schemas owned by the role configured in the user mapping --- 8816,8822 ---- AS t(role_name name); role_name ----------- ! rtorre (1 row) -- Select schemas owned by the role configured in the user mapping ====================================================================== ``` but when it is executed from the contrib/postgres_fdw dir, it works as expeted (note in my env there's a PGUSER=postgres variable): ``` $ pwd /home/rtorre/src/postgres/pg11_build/contrib/postgres_fdw $ make clean all install installcheck ... ============== dropping database "contrib_regression" ============== DROP DATABASE ============== creating database "contrib_regression" ============== CREATE DATABASE ALTER DATABASE ============== running regression test queries ============== test postgres_fdw ... ok ===================== All 1 tests passed. ===================== ``` I'd rather remove this environment-dependent test (on CURRENT_USER) than review all makefiles and possible configurations.
Previously it could actually send commands, but since it wasn't really getting tuples, it failed with an empty error message.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A PoC of a function to execute arbitrary queries through a foreign server.
Signature:
Examples of usage: