6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_4142_test.py

57 lines
1.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-23 20:41:55 +01:00
"""
ID: issue-4469
ISSUE: 4469
TITLE: Regression: Server crashes while preparing a query with DISTINCT and ORDER BY
DESCRIPTION:
JIRA: CORE-4142
FBTEST: bugs.core_4142
2022-01-23 20:41:55 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
recreate table trel(id smallint, name char(31) character set unicode_fss collate unicode_fss);
commit;
insert into trel(id, name) select row_number()over(), 'RDB$NAME_' || row_number()over()
from rdb$types
rows 9;
commit;
alter table trel add constraint trel_name_unq unique (name);
create index trel_id on trel(id);
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
select distinct id + 0 id, name
from trel
order by name;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
act = isql_act('db', test_script, substitutions=[('=.*', '')])
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
ID NAME
== ==========
1 RDB$NAME_1
2 RDB$NAME_2
3 RDB$NAME_3
4 RDB$NAME_4
5 RDB$NAME_5
6 RDB$NAME_6
7 RDB$NAME_7
8 RDB$NAME_8
9 RDB$NAME_9
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-23 20:41:55 +01:00
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