Skip to content
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

UTF-8 in name of db file #1

Open
mkgrgis opened this issue Apr 6, 2020 · 5 comments
Open

UTF-8 in name of db file #1

mkgrgis opened this issue Apr 6, 2020 · 5 comments
Assignees
Labels

Comments

@mkgrgis
Copy link

mkgrgis commented Apr 6, 2020

in isql-fb

Use CONNECT or CREATE DATABASE to specify a database
SQL>CREATE DATABASE '/var/firebird/Пример.fdb' USER 'SYSDBA' PASSWORD 'masterkey' DEFAULT CHARACTER SET UTF8;

then

SQL> CONNECT '/var/firebird/Пример.fdb' USER 'SYSDBA' PASSWORD 'masterkey';
Database: '/var/firebird/Пример.fdb', User: SYSDBA
SQL>

but in bash

fbsql -d '/var/firebird/Пример.fdb' -u 'SYSDBA' -p 'masterkey';
fbsql 0.2.0
Error connecting to '/var/firebird/Пример.fdb' as 'SYSDBA'

Is this error of libfq lib?

@mkgrgis
Copy link
Author

mkgrgis commented Aug 27, 2020

No problems with firebird_fdw for '/var/firebird/Пример.fdb' or '/tmp/テスト.fdb'. This issue really belongs to fbsql.

@ibarwick ibarwick self-assigned this Aug 28, 2020
@ibarwick ibarwick added the bug label Aug 28, 2020
@ibarwick
Copy link
Owner

ibarwick commented Aug 28, 2020

I can reproduce the issue.

I've modified the connection code to actually output the error message returned by Firebird:

$ ./src/fbsql -d localhost:/tmp/テスト.fdb -u sysdba -p masterkey
fbsql 0.2.0
Error connecting to 'localhost:/tmp/テスト.fdb' as 'sysdba'
Invalid connection string
 - Cannot transliterate character between character sets
 - Invalid or incomplete multibyte or wide character

The connection code in both fbsql and firebird_fdw basically does the same thing, the main difference is that in firebird_fdw the connection string is coming from within PostgreSQL, with fbsql it's coming from the shell environment. I can't see what difference that makes though, but obviously there's an issue somewhere.

@mkgrgis
Copy link
Author

mkgrgis commented Aug 28, 2020

The ISC_DATABASE='/tmp/テスト.fdb' fbsql -u sysdba -p 'masterkey'; shell command is similar to fbsql -d localhost:/tmp/テスト.fdb -u sysdba -p masterkey by behaviour.
Either the problem is in both cases of passing arguments, or not in passing arguments.

This was referenced Jan 12, 2023
@mkgrgis
Copy link
Author

mkgrgis commented Jan 16, 2023

Look like this problem is inside isc_attach_database but there is no problem if passing db_path form firebird_fdw. localhost prefix isn't critical.

@mkgrgis
Copy link
Author

mkgrgis commented Jan 25, 2023

@ibarwick, what is external form of the database file string from PostgreSQL FDW API? For example near server_options.database.opt.strptr = &svr_database

Debug output gdb look like a problem between UTF-8, 1byte and wide character.

Error connecting to 'localhost:/tmp/テスト.fdb' as 'sysdba' in fbsql, but psql

set client_min_messages='debug3';
...
デバッグ:  server option: "address"
デバッグ:  server option: "database"
デバッグ:  path: localhost:/tmp/テスト.fdb
デバッグ:  client_encoding: "UTF8"
デバッグ:  firebirdGetConnection(): DB connection OK
デバッグ:  firebirdInstantiateConnection(): new firebird_fdw connection 0x564c2512fa10 for server "fb テスト"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants