2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
"""
|
|
|
|
ID: issue-3213
|
|
|
|
ISSUE: 3213
|
|
|
|
TITLE: Join condition fails for UTF-8 databases
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-2826
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_2826
|
2022-01-21 18:49:26 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
set autoddl off;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
create collation unicode_nopad for utf8 from unicode no pad;
|
|
|
|
-- !!! >>> COMMENTED THIS ACCORDING TO NOTES IN THE TICKET: >>> commit; <<<
|
|
|
|
-- Table is created in the same transaction as collation:
|
|
|
|
create table tst1_nopad (
|
|
|
|
k1 varchar(3) character set utf8 collate unicode_nopad,
|
|
|
|
k2 int,
|
|
|
|
k3 char(1) character set utf8 collate unicode_nopad,
|
|
|
|
primary key (k1, k2, k3) using index txt1_nopad_pk
|
|
|
|
);
|
|
|
|
commit;
|
|
|
|
|
|
|
|
insert into tst1_nopad values ('ap', 123, ' ');
|
|
|
|
insert into tst1_nopad values ('hel', 666, 'v');
|
|
|
|
commit;
|
2022-01-21 18:49:26 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
set list on;
|
|
|
|
set plan on;
|
|
|
|
select t1.*
|
|
|
|
from tst1_nopad t1
|
|
|
|
where t1.k1 = 'ap'
|
|
|
|
and t1.k2 = 123
|
|
|
|
and t1.k3 = ' '
|
|
|
|
plan (t1 natural);
|
2022-01-21 18:49:26 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
select t1.*
|
|
|
|
from tst1_nopad t1
|
|
|
|
where t1.k1 = 'ap'
|
|
|
|
and t1.k2 = 123
|
|
|
|
and t1.k3 = ' ';
|
2022-01-21 18:49:26 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
-- 'show table' was removed, see CORE-4782 ("Command `SHOW TABLE` fails..." - reproduced on Windows builds 2.5 and 3.0 only)
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
PLAN (T1 NATURAL)
|
|
|
|
K1 ap
|
|
|
|
K2 123
|
2022-01-21 18:49:26 +01:00
|
|
|
K3
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
PLAN (T1 INDEX (TXT1_NOPAD_PK))
|
|
|
|
K1 ap
|
|
|
|
K2 123
|
2022-01-21 18:49:26 +01:00
|
|
|
K3
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|