2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
"""
|
|
|
|
ID: issue-6122
|
|
|
|
ISSUE: 6122
|
|
|
|
TITLE: Varchar computed column without explicit type does not populate RDB$CHARACTER_LENGTH
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-5862
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_5862
|
2022-01-26 21:10:46 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
db = db_factory(charset='UTF8')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
recreate table test (
|
|
|
|
id int
|
|
|
|
,vc_default_user varchar(100) default user
|
|
|
|
,vc_default_literal varchar(100) default 'literal'
|
|
|
|
,vc_generated_explicit varchar(201) computed by (vc_default_user || ' ' || vc_default_literal)
|
2022-01-26 21:10:46 +01:00
|
|
|
,vc_generated_implicit computed by (vc_default_user || ' ' || vc_default_literal)
|
2021-04-26 20:07:00 +02:00
|
|
|
);
|
|
|
|
commit;
|
|
|
|
|
|
|
|
set list on;
|
|
|
|
select
|
|
|
|
rf.rdb$field_name
|
|
|
|
,ff.rdb$field_length
|
|
|
|
,ff.rdb$character_length
|
|
|
|
from rdb$relation_fields rf
|
|
|
|
join rdb$fields ff on rf.rdb$field_source = ff.rdb$field_name
|
2022-01-26 21:10:46 +01:00
|
|
|
where
|
|
|
|
upper(rf.rdb$relation_name) = upper('test')
|
2021-04-26 20:07:00 +02:00
|
|
|
and upper(rf.rdb$field_name) starting with upper('vc_generated_')
|
|
|
|
order by rf.rdb$field_position
|
|
|
|
;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
RDB$FIELD_NAME VC_GENERATED_EXPLICIT
|
|
|
|
|
|
|
|
RDB$FIELD_LENGTH 804
|
|
|
|
RDB$CHARACTER_LENGTH 201
|
|
|
|
|
|
|
|
RDB$FIELD_NAME VC_GENERATED_IMPLICIT
|
|
|
|
|
|
|
|
RDB$FIELD_LENGTH 804
|
|
|
|
RDB$CHARACTER_LENGTH 201
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=4.0')
|
2022-01-26 21:10:46 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|