tds_fdw
tds_fdw copied to clipboard
IMPORT FOREIGN SCHEMA fails due to syntax error (MSSQL)
ERROR: syntax error at or near ")" at character 470 QUERY: SELECT t.table_name, c.column_name, c.data_type, c.column_default, c.is_nullable, c.character_maximum_length, c.numeric_precision, c.numeric_precision_radix, c.numeric_scale, c.datetime_precision FROM information_schema.tables t LEFT JOIN information_schema.columns c ON t.table_schema = c.table_schema AND t.table_name = c.table_name WHERE t.table_type = 'BASE TABLE' AND t.table_schema = 'dbo' ORDER BY t.table_name, c.ordinal_position ) SERVER mssqlforeignserver OPTIONS (schema_name 'dbo', table_name ''); STATEMENT: IMPORT FOREIGN SCHEMA dbo FROM SERVER mssqlforeignserver INTO mssql_dbo;
This is off of the current master, built on CentOS 7, PostgreSQL 9.6.
I found the problem--in my case, the user did not have permission to see anything in the target database, so the information schema query returned no rows. The code fell through that section and attempted then to run the problem query I encountered. A no-rows found case should probably be checked for and handled.
@AndrewGrossman what version of tds_fdw
are you using? I get an error:
ERROR: foreign-data wrapper "tds_fdw" does not support IMPORT FOREIGN SCHEMA
Running the version that comes from BIGSQL and labeled as 1.0.8
https://www.openscg.com/bigsql/docs/tds_fdw.jsp/
I was running off of the master branch at the time, I think that's something like 2.0.0 alpha.
I see. Thank you.