ibarwick / firebird_fdw

A PostgreSQL foreign data wrapper (FDW) for Firebird - latest version 1.4.0 (2024-05-11)
https://sql-info.de/postgresql/firebird-fdw/index.html
Other
36 stars 9 forks source link

couldn't connect to firebird #2

Closed xaba closed 9 years ago

xaba commented 10 years ago

Any query to a foreign table was returning: "ERROR: Unable to to connect to foreign server - error 1"

Eventually, i commented out in function firebirdGetConnection (from connection.c) the lines:

kw[i] = "client_encoding";
val[i] = GetDatabaseEncodingName();
i++;

After that the query ran fine. FYI, the value returned by GetDatabaseEncodingName() was UTF8.

ibarwick commented 10 years ago

Thanks for the feedback.

Which Firebird version and which PostgreSQL version are you using here?

xaba commented 10 years ago

Unfortunately my query was only a count. When asking to get the rows i get a strange result:

 column1 | column2 | column3
---------+---------+---------
 1       |         |
 1       |         |

The number of rows is correct, but the returned data isn't. The foreign table is created with the options (query 'select column1, column2, column3 from tablename') I've tried with different tables and got the same result. I created a trivial table test(a int, b int) in firebird and the foreign table fb_test created with the query options exhibited the same issue. That said when created with tablename option:

create foreign table fb_test (a int, b int) server firebird_server
options (table_name 'test');

the query returns the actual data. This seems to be a different issue and not the result of my workaround.

To answer your question, here are the versions: firebird: 2.5.2 postgresql: 9.3.4

ibarwick commented 10 years ago

Hmm, to be honest the 'query' option was a bit of an afterthought, I probably haven't tested it much. I'll have a look when I have a chance.

Oh yes, which OS(es) are you using?

xaba commented 10 years ago

Thanks for looking into this. I'm using Debian Jessie. Should i open a new issue for that one?

ibarwick commented 10 years ago

I've pushed a fix for tables defined using the 'query' option.

Not sure what's happening with the encoding, it works for me on OS X and OpenSUSE, but no time to look into it at the moment.

xaba commented 10 years ago

Thanks, I've just tested it with success.