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_0859_test.py

41 lines
1.3 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-18 20:45:21 +01:00
"""
ID: issue-1249
ISSUE: 1249
TITLE: Sorting is allowed for blobs and arrays
DESCRIPTION:
NOTES:
For now we test that such operations raise an exception, as we restored the legacy
behavior until we're able to implement DISTINCT for blobs properly,
JIRA: CORE-859
FBTEST: bugs.core_0859
2022-01-18 20:45:21 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2022-01-18 20:45:21 +01:00
from firebird.qa import *
from firebird.driver import DatabaseError
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
init_script = """create table t (i integer, b blob sub_type text, a integer [5]);
2021-04-26 20:07:00 +02:00
"""
2022-01-18 20:45:21 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
with act.db.connect() as con:
c = con.cursor()
2021-12-22 20:23:11 +01:00
# Use with to free the Statement immediately
with c.prepare('select * from t order by b'):
pass
with pytest.raises(DatabaseError, match='.*Datatype ARRAY is not supported for sorting operation.*'):
c.prepare('select * from t order by a')
2021-12-22 20:23:11 +01:00
# Use with to free the Statement immediately
with c.prepare('select b, count(*) from t group by b'):
pass
with pytest.raises(DatabaseError, match='.*Datatype ARRAY is not supported for sorting operation.*'):
c.prepare('select a, count(*) from t group by a')
# Passed.