6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/bugs/core_4529_test.py

51 lines
1004 B
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-4847
ISSUE: 4847
TITLE: Allow to use index when GROUP BY on field which has DESCENDING index
DESCRIPTION:
JIRA: CORE-4529
FBTEST: bugs.core_4529
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
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
test_script = """
recreate table t(x int, y int);
2021-04-26 20:07:00 +02:00
commit;
2022-01-23 20:41:55 +01:00
insert into t select rand()*5, rand()*5
from rdb$types;
2021-04-26 20:07:00 +02:00
commit;
2022-01-23 20:41:55 +01:00
create DESCENDING index t_x_desc on t(x);
create DESCENDING index t_c_desc on t computed by( x+y );
2021-04-26 20:07:00 +02:00
commit;
set planonly;
select x,max(y) from t group by x;
2022-01-23 20:41:55 +01:00
select x,min(y) from t group by x;
2021-04-26 20:07:00 +02:00
select count(x) from t group by ( x+y );
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)
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
PLAN (T ORDER T_X_DESC)
PLAN (T ORDER T_X_DESC)
PLAN (T ORDER T_C_DESC)
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=4.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