-
Notifications
You must be signed in to change notification settings - Fork 99
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
Installation on Windows #53
Comments
I haven't tried installing it on Windows yet. It looks like FreeTDS supports Windows, so it may also be possible to build tds_fdw on Windows. |
Hello GeoffMontee, Thank you. |
Hi @ivomts, I still haven't tried installing it on Windows yet, so I'm not sure exactly what process you would use. I would like to try some day, if I can find the time. If anyone else wants to try, here are some tips: You'll probably need to build FreeTDS on Windows, so this documentation might be helpful. For building tds_fdw, this wiki page might be helpful. There are different steps shown depending on whether you are compiling with Visual Studio or MinGW. If you plan to use Visual Studio, this blog post might also be useful. |
If you're going the MinGW-w64 route I created a video tutorial on how to install it at https://youtu.be/pb6Yb819pF0 I, too, would try to compile this for Windows but not sure when I will get to it, or if I'll have any success at all. |
Thanks for sharing, @TwentyOneSolutions! That should be useful if I try to test this out with MinGW. |
Thanks you @TwentyOneSolutions and @GeoffMontee. |
Clearly this exceeds my capabilities. Goal was to get to a 64bit version of tds_fdw. Building FreeTDS 0.95.87 with this:
Using this as a guide (http://blog.2ndquadrant.com/compiling-postgresql-extensions-visual-studio-windows/) with VS Studio 2015 Community edition, adding include paths as needed (e.g., to find tds_sysdep_public.h in \win32 directory), hit a wall of 26 LNK2001 unresolved external symbols in tds_fdw.obj for symbols such as dbiscount, dbconvert, etc. Has anyone smarter than me succeeded in creating a Win64 binary? Best Regards, |
Hi @jkort, The |
Thanks Geoff, The only library created by the nmakefile is db-lib.LIB, I get no .DLL I imagine I'm doing something very basic incorrectly. |
It sounds like You might just have to add |
Realized I could use Cmake instead of Nmake, so started over with FreeTDS. Got FreeTDS to build, then after many iterations of adding .LIB dependencies under VS, got a tds_fdw.DLL to build. Copied it to PG's 9.4\lib folder. Just tried to run your CREATE FUNCTION sql, with 'tds_fdw' for 'MODULE_PATHNAME', and got an eror that no function by that name. Under Dependency Walker I see that the handler and validator functions are named: So if I modified the CREATE FUNCTION calls and the CREATE FOREIGN DATA WRAPPER as below for the prefixed names, they execute. But the CREATE EXTENSION throws an error: CREATE FUNCTION pg_finfo_tds_fdw_handler() CREATE FUNCTION pg_finfo_tds_fdw_validator(text[], oid) CREATE FOREIGN DATA WRAPPER tds_fdw CREATE EXTENSION IF NOT EXISTS tds_fdw with schema my_extensions;ERROR: could not find function "tds_fdw_handler" in file "C:/Program Files/PostgreSQL/9.4/lib/tds_fdw.dll" ********** Error ********** ERROR: could not find function "tds_fdw_handler" in file "C:/Program Files/PostgreSQL/9.4/lib/tds_fdw.dll" Is there something I can do to rename those functions to make this work? |
I may have solved my own problem using ALTER FUNCTION ... RENAME TO ... |
The SQL in \share\extension\ with the control file was changed to this to accommodate the prefixed function names I see in the tds_fdw.DLL: CREATE FUNCTION pg_finfo_tds_fdw_handler() ALTER FUNCTION pg_finfo_tds_fdw_handler() CREATE FUNCTION pg_finfo_tds_fdw_validator(text[], oid) ALTER FUNCTION pg_finfo_tds_fdw_validator(text[], oid) CREATE FOREIGN DATA WRAPPER tds_fdw All of these commands (sanitized with dummy strings as needed) run without error: CREATE EXTENSION IF NOT EXISTS tds_fdw CREATE SERVER xyz DROP USER MAPPING IF EXISTS FOR postgres SERVER xyz; CREATE USER MAPPING FOR postgres DROP FOREIGN TABLE IF EXISTS objecttyper; CREATE FOREIGN TABLE objecttyper ( But when I try to run this I get the following error: select * from objecttyper;ERROR: foreign-data wrapper handler function 16508 did not return an FdwRoutine struct ********** Error ********** ERROR: foreign-data wrapper handler function 16508 did not return an FdwRoutine struct SQL state: XX000I see tds_fdw in pgAdmin III as a FDW, but do not see it listed as an Extension. Now when I try to run a query like: get the same error as above. I thought I was close to getting this to work...maybe not. :( |
Found a similar posting about "pg_finfo_" prefixing, with no clear direction on what preprocessor definitions I could use in my Visual Studio project to fix the function creations: |
I realized I had not followed Craig Ringer's requirement to have a PGDLLEXPORT prototype, so I added these first two lines to tds_fdw.c: PG_FUNCTION_INFO_V1(tds_fdw_handler); Datum tds_fdw_handler(PG_FUNCTION_ARGS) Rebuilt the tds_fdw.DLL, and under Dependency Walker still saw the functions with the pg_finfo_ prefix, but now two versions with correct names. Put new DLL into the 9.4\lib folder; corrected the SQL file in 9.4\share\extension to use correct func names and take out my ALTER FUNCTION code. CREATE EXTENSION, CREATE SERVER, CREATE FOREIGN TABLE all run without error, but as soon as I try to SELECT from it my conenction to postgres db is dropped. Unless someone can see an obvious error, I think I best admit defeat and leave extensions to the experts. Thanks for your time! |
It sounds like you've made some great progress! If your connection is getting dropped, then it sounds like the backend might be crashing. Is there any information in your PostgreSQL error log that can give us a clue about what's happening? |
Thanks Geoff! I was ready to give up and stop bothering you. Took me a bit as a newbie to find the log; here's what it shows around that SELECT from the foreign table I defined: 2016-03-10 08:36:01 PST LOG: database system was interrupted; last known up at 2016-03-10 08:30:11 PST 2016-03-10 08:39:41 PST HINT: See C include file "ntstatus.h" for a description of the hexadecimal value. |
Thanks Geoff! I'm sure there are numerous places I could have gone wrong. If I can figure out how to run this under a debugger I will. Any time you can give to it will be greatly appreciated, and if there's anything else I can provide let me know. |
Hi, I am also very very interested in this wrapper for windows x64. I don't have a technical profile to help with the compilation but I hope there is some progress soon. Great job @GeoffMontee Regards. |
Hello, I compiled the tds_fdw in Visual Studio 2013, I followed some of @jkort comments and I got his same issue, PG crashes right after performing the select I did a little debug in visual studio and I noticed the extension crashes in this line of code in iconv.c assert(strcmp(canonic_charsets[POS_UCS2LE].name, "UCS-2LE") == 0); I commented those lines and the extension worked perfect I'm not quite sure what's exactly going on, this is not about the extension I think; I think it has to be about the canonic_charsets array |
Nice work, @lorenati! FreeTDS uses iconv to do character set conversions. The version of the FreeTDS protocol that you are using can effect what conversions are used. For example, when you are using |
This is what I did: I downloaded a copy of the freetds release and I included the required dependencies in my project and I compiled those along with the tds_fdw extension code. I did not make a separate build of freetds and tds_fdw. Probably I need to compile those individualy in order to set some configurations, specially with freetds. I used a freetds version from like 3 days ago. Also, with my extension 'as is' I did a select of a column with UTF-8 encoding (words like 'pasé' in spanish) these columns appears blank in PG. |
@lorenati - Can you please publish your compiled binaries somewhere so that we can download it without needing to compile? Thanks! |
+1 Great job @lorenati |
@lorenati Thank you very much for your input on this, but can you help me here in the compilation process? I'm trying to do the exact same setup that you and @jkort described here to compile a x64 windows version of tds_fdw for postgres 9.5, but i'm at the point where @jkort described that after making a select the connection is dropped. I have exactly the same output in the postgres log file as @jkort described. I also did comment the lines you said in the iconv.c, but my tds_fdw code does not seem to be influenced in any way by that change. Can you describe a little better how did you compiled freetds and tds_fdw together on the same visual studio solution? Thanks! |
@lorenati Please can you publish your compiled binaries??? |
@lorenati Great, thanks! I'll check it out. |
@lorenati Thanks!!! I'll check it out too |
@alexeyfadeev thanks for sharing the binaries!
After pasteing the files in PostgreSQL folder I go to pgadmin and type: I get the same error in both servers:
|
@jaitor1, I think tds_fdw should be built with the same major version of Postgres. This binaries for PG 10. |
@alexeyfadeev if you could help me it would be imcredible. I've been years waiting for someone to compile it for windows :) |
@jaitor1, I built it.
If some files are missing, you can copy them from here:
|
i test it on win10 x64,but it does't work. tds_fdw binaries, PostgreSQL 11 for Windows x64 c:\PostgreSQL\11\bin>psql -p 5555 -U postgres postgres=# create extension tds_fdw; |
what i need : Windows Server 2008 R2 Enterprise sp1 x64 with PostgreSQL 9.X or 10 or 11. |
It is working on Windows 8 PC |
@alexeyfadeev Firstly, thanks for you awesome work. I've been waiting for this SW on windows for years. |
Attached an new prebuild binary for pg_EDB_11_win-x64, and add an linked with iconv to avoid some server encoding issue for varchar in alexeyfadeev's version.
For Install:Copy Versions:dynamic: dynamic linked to NOTE:
|
Thank you @yyjdelete ! |
Hello, |
@Signaluser1 Build with pg12.2(winx64 EDB), VS2019,tds_fdw@93e9b7b (2.0.1) and FreeTDS/freetds@779975b(master or 1.2-dev). Use the same build config as dynamic-LTL in #53 (comment) |
Very impressive. Thank you very much. I can test it next week. |
Hello, CREATE SERVER fdw_mssql Usermapping works fine. But when i create foreign tables they are empty. When i am IMPORT FOREIGN SCHEMA, i got the message No table where found in schema... Whats wrong? |
Can someone help me to create a tds_fwd for windows 10 with PostgreSQL 12 free version? I tried @yyjdelete's build and specified tds_version=7.1
I got following error: |
Hello guys. |
据我了解,现在的版本儿不适合13.0。
…---Original---
From: "David"<notifications@github.com>
Date: 2021/2/19 23:10:24
To: "tds-fdw/tds_fdw"<tds_fdw@noreply.github.com>;
Cc: "Comment"<comment@noreply.github.com>;"huolijian"<38219146@qq.com>;
Subject: Re: [tds-fdw/tds_fdw] Installation on Windows (#53)
Hello guys.
Sorry for my ignorance.
How can you build tds_fdw for Windows?
I wanted to try this with PostgreSQL v13.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@yyjdelete i copied the files as you said in the specific folders but when i run it says |
Hello, would it be possible to get a current version of tds_fwd for PostgreSQL14 and Windows64 (Server 2016)? That would be very helpful. Thanks a lot. Greetings |
I would also be interested.
Greetings |
Hello everybody. |
Hello, can anyone compile it for PostgreSQL 14? or can tell me how to do it? greetings |
Me too!! |
I need to try out this plugin in versions PG14 and 15. Can you share your build environment? If there are build documents available, it would be the best |
Hi, I would really like to build/use this extension with PG15. Would it be possibly for either @yyjdelete or @alexeyfadeev to share their process of building the extension for Windows? Maybe it could even be added to the README of the project? |
Buenas!! me ayudan por favor? Tengo el PostgreSQL 14.7, compiled by Visual C++ build 1914, 64-bit en Windows 11, cómo podría hacer para compilar los binarios necesarios para poder conectarme a SQL Server que se encuentra en un Suse Linux. |
Any successes? I have PG15 and would like to mount MSSQL tables. |
If someone knows how to build or have a newer prebuild for windows server, let me know, can't use docker as Windows Server 2019 does not support WSL2 |
How can I install this on Windows?
Given that this is useful for MSSQL databases it'd be very useful to be able to run it on Windows. Is there any binary distribution available to download? If not, how can I build it for Windows?
Thanks!
The text was updated successfully, but these errors were encountered: