-
Notifications
You must be signed in to change notification settings - Fork 22
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
Support all ODBC SQL #66
Comments
@rafatower, do we have enough users of FDW connectors, particularly using a WHERE clause with more than one qual, for this to be helpful? |
I'll compile a list of users and gather some info from the metrics we have. |
Related to #75, the handling of quals in the current code doesn't seem to actually do anything, probably because it's trying to extract them from the PlanState rather than the Plan. Fixing it would require much of the work that this issue also requires, in terms of deparsing the expression tree into ODBC SQL, and moving that work into an earlier stage of the FDW API (basically, aping the way the OGR FDW and postgres_fdw do it) |
+1000 I primarily used odbc_fdw to extract bulk data from a odbc source into postgres. I understand the true nature of fdw is to be able to join fdw tables, etc... which requires full parsing. I think a quick win for odbc_fdw, would be to provide a fdw option that basically provides a static 'where' clause that will always get pushed to the remote. example without static where: example with static where set to 'dt_created >= date '2015-01-01': |
@thoughtchad doesn't the |
@pramsey As I recall, the sql_query is only used for the import foreign schema. I use it extensively in data integrations. It basically allows one to import the schema automagically without all the fuss of create table and mapping data types. I use it like this: "select cola, colb, colc from the_table where 1=0" - Which provides an very fast schema import, with no data. After much testing, even the where clause on the sql_options is very strange in how it parses it out... 1=0 get's passed to the remote db.... anything else triggers a full remote table query back to the postgres instance - and then the where clause is applied. I've followed the code through, and as soon as it hits the tree parsing - I'm a goner. A sql_where_static option is essentially what I'm looking for. Happy to help in any way I'm able to. |
The current implementation seems to take a very gentle approach to pushing filters to remote, only taking the first qual off the list. It might be nicer to properly deparse the qual tree and write out those pieces of SQL that are considered legal for use in ODBC queries.
https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/sql-minimum-grammar
The text was updated successfully, but these errors were encountered: