Navigation Menu

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

Error when using 16 cyrillic symbols for field name on connection with parameter lc_ctype=WIN1251 [CORE5644] #5910

Open
firebird-automations opened this issue Oct 19, 2017 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Simeon Bodurov (simeon.bodurov)

I am connecting to firebird 3.0.2 database with 32 bit Delphi application and I specify parameter lc_ctype=WIN1251

1. When I try to execute the statement:

SELECT 1 AS "АБВГДЕЖЗИЙКЛМНОП" FROM RDB$DATABASE

I receive error:
arithmetic exception, numeric overflow, or string truncation
string right truncation
expected length 31, actual 16.

"АБВГДЕЖЗИЙКЛМНОП" is 16 symbols long.

Why I receive "string right truncation" when expected length 31 and actual 16 ?

2. This statement works:
SELECT 1 AS "АБВГДЕЖЗИЙКЛМНО" FROM RDB$DATABASE

"АБВГДЕЖЗИЙКЛМНО" is 15 symbols long.

3.

SELECT 1 AS "АБВГДЕЖЗИЙКЛМНОПАБВГДЕЖЗИЙКЛМНО" FROM RDB$DATABASE

where field name is 31 symbols gives error

arithmetic exception, numeric overflow, or string truncation.
string right truncation.
expected length 31, actual 31.

4.

SELECT 1 AS "АБВГДЕЖЗИЙКЛМНОПАБВГДЕЖЗИЙКЛМНОП" FROM RDB$DATABASE;

where field name is 32 symbols gives error
Dynamic SQL Error
SQL error code = -104
Name longer than database column size.

as it should be.

When I remove lc_ctype=WIN1251 parameter from connection i.e. use NONE
The statement
SELECT 1 AS "АБВГДЕЖЗИЙКЛМНОП" FROM RDB$DATABASE

executes without error.

SELECT 1 AS "АБВГДЕЖЗИЙКЛМНОПАБВГДЕЖЗИЙКЛМНО" FROM RDB$DATABASE

aslo executes without error.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

security: Developers [ 10012 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: Simeon Bodurov (simeon.bodurov)

I have tried to connect with old Firebird 2.5 client to Firebird 3.0.4.32939 to test this issue. The same happens. When I connect with lc_ctype=WIN1251 parameter and execute SQL statement
SELECT 1 AS "АБВГДЕЖЗИЙКЛМНОП" FROM RDB$DATABASE
There is the same error:
arithmetic exception, numeric overflow, or string truncation.
string right truncation.

May be the problem is in the server, not in the client.

@firebird-automations
Copy link
Collaborator Author

Modified by: Simeon Bodurov (simeon.bodurov)

Version: 3.0.3 [ 10810 ]

Component: Engine [ 10000 ]

Version: 3.0.2 [ 10785 ] =>

Component: API / Client Library [ 10040 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

16 cyrillic characters is 32 bytes which is beyond the limit for the identifier length (31 bytes).

@firebird-automations
Copy link
Collaborator Author

Commented by: Simeon Bodurov (simeon.bodurov)

Dmitry,

Why 16 cyrillic characters are represented with 32 bytes when I am using encoding WIN1251 ???? How is done that ? And why there is so confusing error message "expected length 31, actual 16" ?
I can use up to 31 cyrillic characters as identifier when connection encoding is NONE, but when it is WIN1251 I cannot use more that 16 cyrillic characters ? I think that in WIN 1251 cyrillic characters are represented with 1byte. Not 2 bytes.
Every report that we made with Firebird 2.5 now have to be corrected to have identifiers with no more that 15 cyrillic characters or we have to use NONE as connection encoding, but that way we cannot modify stored procedures in database because cyrillic comments are not decoded properly ...

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

No branches or pull requests

1 participant