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
|
2022-02-02 15:46:19 +01:00
|
|
|
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 *
|
2021-12-15 22:02:07 +01:00
|
|
|
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:
|
2021-12-15 22:02:07 +01:00
|
|
|
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
|
2021-12-15 22:02:07 +01:00
|
|
|
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
|
2021-12-15 22:02:07 +01:00
|
|
|
with pytest.raises(DatabaseError, match='.*Datatype ARRAY is not supported for sorting operation.*'):
|
|
|
|
c.prepare('select a, count(*) from t group by a')
|
|
|
|
# Passed.
|