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

Added/Updated bugs\gh_6740_test.py. Checked on 5.0.0.509.

This commit is contained in:
zotov 2022-06-30 11:03:47 +03:00
parent fccda06597
commit 8760ded984

View File

@ -5,53 +5,45 @@ ID: issue-6740
ISSUE: 6740 ISSUE: 6740
TITLE: Allow parenthesized query expression for standard-compliance TITLE: Allow parenthesized query expression for standard-compliance
DESCRIPTION: DESCRIPTION:
NOTES: Queries which do not use `WITH` clause now can be enclosed in parenthesis,
Queries which do not use `WITH` clause now can be enclosed in parenthesis, but this leads to reduced number of max parts of UNIONed query, from 255 to 128.
but this leads to reduced number of max parts of UNIONed query, from 255 to 128.
JIRA: CORE-6511 JIRA: CORE-6511
FBTEST: bugs.gh_6740 FBTEST: bugs.gh_6740
NOTES:
[30.06.2022] pzotov
Error message in case when NUM_OF_UNIONED_PARTS >= 129 can obfuscate:
"Too many Contexts of Relation/Procedure/Views. Maximum allowed is 256"
Max limit of unioned-parts is 128, it was explained by Adriano in the ticket.
Checked on 5.0.0.509.
""" """
import pytest import pytest
from firebird.qa import * from firebird.qa import *
db = db_factory() db = db_factory()
act = python_act('db') act = python_act('db')
expected_stdout = """ NUM_OF_UNIONED_PARTS = 128
8256 unioned_query = '('
""" for i in range(0,NUM_OF_UNIONED_PARTS):
unioned_query = ''.join( (unioned_query, 'select %d ' % (i+1) + ('as i ' if i==0 else '') + 'from rdb$database') )
if i < NUM_OF_UNIONED_PARTS-1:
unioned_query = ''.join( (unioned_query, ' union all (') )
unioned_query = ''.join( (unioned_query, ')' * NUM_OF_UNIONED_PARTS) )
expected_stdout = "8256"
@pytest.mark.skip('FIXME: Not IMPLEMENTED')
@pytest.mark.version('>=5.0') @pytest.mark.version('>=5.0')
def test_1(act: Action): def test_1(act: Action, capsys):
pytest.fail("Not IMPLEMENTED")
# test_script_1
#--- with act.db.connect() as con:
# cur = con.cursor()
# # NB! Max limit of unioned-parts is 128 rather than 255! cur.execute(unioned_query)
# ######################## print( sum([x[0] for x in cur.fetchall()]) )
# NUM_OF_UNIONED_PARTS=128
# ######################## act.expected_stdout = expected_stdout
# act.stdout = capsys.readouterr().out
# unioned_query = '(' assert act.clean_stdout == act.clean_expected_stdout
# for i in range(0,NUM_OF_UNIONED_PARTS):
# unioned_query = ''.join( (unioned_query, 'select %d ' % (i+1) + ('as i ' if i==0 else '') + 'from rdb$database') )
# if i < NUM_OF_UNIONED_PARTS-1:
# unioned_query = ''.join( (unioned_query, ' union all (') )
#
# unioned_query = ''.join( (unioned_query, ')' * NUM_OF_UNIONED_PARTS) )
# unioned_query += ';'
#
# #print(unioned_query)
#
# cur = db_conn.cursor()
# cur.execute(unioned_query)
# total = 0
# for r in cur:
# total += r[0]
# cur.close()
# print(total)
#---