6

I need to be able to query a SQL Server database from within Postgresql. The Postgres instance is running locally and the SQL server set up as an ODBC data source. How do I add this as a linked server? Is there a better approach?

Thanks

ZeroEric
  • 371
  • 1
  • 4
  • 7

1 Answers1

4

The two available options are:

  • DBI-Link; or
  • The ODBC-FDW (SQL/MED foreign data wrapper)

DBI-link is more mature, and will work on Windows. The ODBC FDW is likely to be better once it's properly finished, but at this point it isn't, and AFAIK it is not available on Windows.

See:

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
  • Do you know if the ODBC FDW is properly finished now Craig? –  Jan 11 '14 at 16:27
  • @JackDouglas Unless someone else has picked it up it is moribund. The last commit is 2 years ago. https://github.com/ZhengYang/odbc_fdw . The fork graph shows a few people working on it, including Andrew Dunstain (https://github.com/ZhengYang/odbc_fdw/network), but no sustained effort. – Craig Ringer Jan 12 '14 at 01:04
  • Thanks, I've been using dbi-link for years and I think I will stick with it for now :) –  Jan 17 '14 at 07:55