mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
127 lines
4.1 KiB
Python
127 lines
4.1 KiB
Python
#coding:utf-8
|
|
|
|
"""
|
|
ID: issue-2965
|
|
ISSUE: 2965
|
|
TITLE: CI column does not group correctly with a second column
|
|
DESCRIPTION:
|
|
JIRA: CORE-2555
|
|
FBTEST: bugs.core_2555
|
|
"""
|
|
|
|
import pytest
|
|
from firebird.qa import *
|
|
|
|
db = db_factory(charset='UTF8')
|
|
|
|
test_script = """
|
|
recreate table test(
|
|
rk char(1) character set none
|
|
,ca varchar(10) character set utf8 collate unicode_ci_ai
|
|
,cb varchar(10) character set utf8 collate unicode_ci
|
|
,id int generated by default as identity constraint pk_test primary key using index pk_test
|
|
);
|
|
commit;
|
|
|
|
-- Letters from latin-1 with diacritic marks: http://en.wikipedia.org/wiki/ISO/IEC_8859-1
|
|
insert into test(rk, ca, cb) values('d', 'ð', 'd');
|
|
insert into test(rk, ca, cb) values('d', 'Ð', 'd');
|
|
insert into test(rk, ca, cb) values('d', 'Ð', 'D');
|
|
insert into test(rk, ca, cb) values('d', 'd', 'd');
|
|
|
|
insert into test(rk, ca, cb) values('l', 'l', 'Ł');
|
|
insert into test(rk, ca, cb) values('l', 'ł', 'ł');
|
|
|
|
insert into test(rk, ca, cb) values('o', 'Ø', 'õ');
|
|
insert into test(rk, ca, cb) values('o', 'o', 'Õ');
|
|
insert into test(rk, ca, cb) values('o', 'Ó', 'Õ');
|
|
insert into test(rk, ca, cb) values('o', 'õ', 'Õ');
|
|
insert into test(rk, ca, cb) values('o', 'Ö', 'õ');
|
|
|
|
insert into test(rk, ca, cb) values('a', 'Ą', 'ä');
|
|
insert into test(rk, ca, cb) values('a', 'Á', 'Ä');
|
|
insert into test(rk, ca, cb) values('a', 'à', 'ä');
|
|
insert into test(rk, ca, cb) values('a', 'â', 'ä');
|
|
|
|
insert into test(rk, ca, cb) values('c', 'ç', 'Ç');
|
|
insert into test(rk, ca, cb) values('c', 'Ç', 'ç');
|
|
insert into test(rk, ca, cb) values('c', 'C', 'Ç');
|
|
|
|
insert into test(rk, ca, cb) values('u', 'Ú', 'û');
|
|
insert into test(rk, ca, cb) values('u', 'Ù', 'Û');
|
|
insert into test(rk, ca, cb) values('u', 'ü', 'û');
|
|
|
|
insert into test(rk, ca, cb) values('s', 'Š', 'Š');
|
|
insert into test(rk, ca, cb) values('s', 'ş', 'š');
|
|
insert into test(rk, ca, cb) values('s', 'š', 'Š');
|
|
|
|
insert into test(rk, ca, cb) values('n', 'Ñ', 'ñ');
|
|
insert into test(rk, ca, cb) values('n', 'ñ', 'ñ');
|
|
insert into test(rk, ca, cb) values('n', 'Ň', 'Ñ');
|
|
commit;
|
|
|
|
set list on;
|
|
set plan on;
|
|
|
|
-- First, we check result of NATURAL scans:
|
|
select rk from test group by ca,cb,rk;
|
|
commit;
|
|
|
|
-- Then, check results of GROUP BY when it can use index.
|
|
-- ::: NOTE :::
|
|
-- As of current state (WI-T3.0.0.31832 beta-2), FB cah do GROUP BY
|
|
-- WITH using of index on multi-byte or insensitive collation only
|
|
-- when this index is: 1) UNIQUE and 2) ASCENDING.
|
|
-- Index still not used in DISTINCT statement, so it's not checked.
|
|
-- See comments in CORE-4787.
|
|
create unique index test_unq1 on test(ca, cb, rk, id);
|
|
create unique index test_unq2 on test(cb, rk, ca, id);
|
|
commit;
|
|
|
|
set plan on;
|
|
select rk from test group by ca,cb,rk;
|
|
select rk from test group by cb,rk,ca;
|
|
"""
|
|
|
|
act = isql_act('db', test_script)
|
|
|
|
expected_stdout = """
|
|
|
|
PLAN SORT (TEST NATURAL)
|
|
RK a
|
|
RK c
|
|
RK d
|
|
RK l
|
|
RK n
|
|
RK o
|
|
RK s
|
|
RK u
|
|
|
|
PLAN (TEST ORDER TEST_UNQ1)
|
|
RK a
|
|
RK c
|
|
RK d
|
|
RK l
|
|
RK n
|
|
RK o
|
|
RK s
|
|
RK u
|
|
|
|
PLAN (TEST ORDER TEST_UNQ2)
|
|
RK a
|
|
RK c
|
|
RK d
|
|
RK l
|
|
RK n
|
|
RK o
|
|
RK s
|
|
RK u
|
|
"""
|
|
|
|
@pytest.mark.version('>=3.0')
|
|
def test_1(act: Action):
|
|
act.expected_stdout = expected_stdout
|
|
act.execute()
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
|
|