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

77 lines
1.8 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-4045
ISSUE: 4045
TITLE: String truncation error when selecting from a VIEW with UNION inside
DESCRIPTION:
JIRA: CORE-3697
FBTEST: bugs.core_3697
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory(from_backup='core3697-ods11.fbk')
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
-- Confirmed on 2.5.1:
-- Statement failed, SQLSTATE = 22001
-- arithmetic exception, numeric overflow, or string truncation
-- -string right truncation
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
create or alter view TREE_TEST (
ID, TEXT, PARENTID, CONDITIONS,
STMT, RULFNAME )
as
select 0, 'Организации', NULL, '', ''
, 'KODORG'
from rdb$database
union
select uidorg
, nameorg
, '0'
, ' G.UIDORG = ' || '''' || uidorg || ''''
, ''
, 'KODORG'
from org_delivery
;
commit;
set list on;
select id, text, parentid, conditions, stmt, rulfname
from tree_test;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
ID 0
TEXT Организации
PARENTID <null>
2022-01-22 21:59:15 +01:00
CONDITIONS
STMT
RULFNAME KODORG
2021-04-26 20:07:00 +02:00
ID 7707083893 380000460
TEXT АНГАРСКОЕ ОТДЕЛЕНИЕ 7690
2022-01-22 21:59:15 +01:00
PARENTID 0
2021-04-26 20:07:00 +02:00
CONDITIONS G.UIDORG = '7707083893 380000460'
2022-01-22 21:59:15 +01:00
STMT
RULFNAME KODORG
2021-04-26 20:07:00 +02:00
ID 7724261610 380000326
TEXT ПОЧТАМТ
2022-01-22 21:59:15 +01:00
PARENTID 0
2021-04-26 20:07:00 +02:00
CONDITIONS G.UIDORG = '7724261610 380000326'
2022-01-22 21:59:15 +01:00
STMT
RULFNAME KODORG
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
@pytest.mark.version('>=3')
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