6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_4768_test.py

64 lines
1.9 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-5068
ISSUE: 5068
TITLE: CREATE USER ... TAGS ( argument_1 = 'value1', ..., argument_N = 'valueN' ) -
wrong results of statement when there are many arguments
2022-01-24 20:27:02 +01:00
DESCRIPTION:
JIRA: CORE-4768
FBTEST: bugs.core_4768
2022-01-24 20:27:02 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
db = db_factory()
2021-11-26 19:20:43 +01:00
2022-01-24 20:27:02 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
expected_stdout = """
2021-11-26 19:20:43 +01:00
USR_NAME TMP$C4768_1
SEC_PLUGIN Srp
2021-04-26 20:07:00 +02:00
TAG_MIN ARG_0
VAL_MIN VAL0
TAG_MAX ARG_99999
VAL_MAX VAL99999
TAG_CNT 100000
Records affected: 1
2021-11-26 19:20:43 +01:00
"""
2021-04-26 20:07:00 +02:00
2021-12-19 22:25:36 +01:00
# Cleanup fixture
2022-01-24 20:27:02 +01:00
tmp_user = user_factory('db', name='tmp$c4768_1', password='123', plugin='Srp',
do_not_create=True)
2021-04-26 20:07:00 +02:00
2021-11-26 19:20:43 +01:00
@pytest.mark.version('>=3.0')
2022-01-24 20:27:02 +01:00
def test_1(act: Action, tmp_user: User):
2021-11-26 19:20:43 +01:00
TAGS_COUNT = 100000
check_lines = ['set bail on;',
2021-12-19 22:25:36 +01:00
"create or alter user tmp$c4768_1 password '123' using plugin Srp tags ("]
2021-11-26 19:20:43 +01:00
for i in range(TAGS_COUNT):
check_lines.append(f"{' ,' if i > 0 else ' '}arg_{i}='val{i}'")
check_lines.append(');')
check_lines.append('commit;')
test_script = '\n'.join(check_lines) + """
set count on;
set list on;
select
u.sec$user_name as usr_name
,u.sec$plugin sec_plugin
,upper(min( a.sec$key )) tag_min
,upper(min( a.sec$value )) val_min
,upper(max( a.sec$key )) tag_max
,upper(max( a.sec$value )) val_max
,count(*) tag_cnt
from sec$users u
left join sec$user_attributes a on u.sec$user_name = a.sec$user_name
where u.sec$user_name = upper('tmp$c4768_1')
group by 1,2 ;
commit;
2021-12-22 20:23:11 +01:00
"""
2022-01-24 20:27:02 +01:00
act.expected_stdout = expected_stdout
act .isql(switches=['-q'], input=test_script)
assert act.clean_stdout == act.clean_expected_stdout