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

incorrect calculation of byte-length for view columns (as in CORE-5049) [CORE6380] #6619

Closed
firebird-automations opened this issue Aug 5, 2020 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Artem Anufriev (atronah)

C:\>isql.exe -ch utf8 -user SYSDBA -pass masterkey

create database '127.0.0.1:c:\TEST_BUG.FDB' page_size 16384 default character set win1251; commit;

connect '127.0.0.1:c:\TEST_BUG.FDB' user 'SYSDBA' password 'masterkey';

create table test_table(
test_code bigint
, test_name varchar(2048)
);

create or alter view test_view as
select distinct
'[' || test_code || ']' || coalesce(test_name, '') as test_field1
, '[' || test_code || ']' || coalesce(test_name, '') as test_field2
, '[' || test_code || ']' || coalesce(test_name, '') as test_field3
, '[' || test_code || ']' || coalesce(test_name, '') as test_field4
, '[' || test_code || ']' || coalesce(test_name, '') as test_field5
, '[' || test_code || ']' || coalesce(test_name, '') as test_field6
, '[' || test_code || ']' || coalesce(test_name, '') as test_field7
, '[' || test_code || ']' || coalesce(test_name, '') as test_field8
from test_table;

Statement failed, SQLSTATE = 54000
unsuccessful metadata update
-new record size of 66260 bytes is too big
-TABLE TEST_VIEW

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Result of COALESCE is VARCHAR(2048) UTF8 (due to empty string literal in UTF8), thus 8KB in size. So the overall concatenation size is more than 64KB. I don't see a bug here.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Compare with e.g. coalesce(test_name, _ascii '') or coalesce(test_name, _win1251 ''). Or use WIN1251 as a connection charset.

@firebird-automations
Copy link
Collaborator Author

Commented by: @livius2

Why it is utf8 not default database charset?
I have supposed that i should specify it only if must be different then default.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

String literals are implied to be represented in the connection charset, not the database charset.

@firebird-automations
Copy link
Collaborator Author

Commented by: Artem Anufriev (atronah)

Thank you for the clarification.

I develop side project for existed production database that has win1251 charset as default, but my project stores sql scripts in utf8 files. And when I ran tests they fell because of problem described above.

I'll try to use charset "_win1251" modifiers

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

This ticket seems to need "won't fix" resolution, no?

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

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