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_0858_test.py

69 lines
1.8 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-18 20:45:21 +01:00
"""
ID: issue-1248
ISSUE: 1248
TITLE: Server crash when using UDF
DESCRIPTION:
NOTES:
[24.01.2019] Disabled this test to be run on FB 4.0
UDF usage is deprecated in FB 4+, see: ".../doc/README.incompatibilities.3to4.txt".
Functions div, frac, dow, sdow, getExactTimestampUTC and isLeapYear got safe replacement
in UDR library "udf_compat", see it in folder: ../plugins/udr/
UDF function 'sright' has direct built-in analog 'right', there is no UDR function for it.
JIRA: CORE-858
FBTEST: bugs.core_0858
2022-01-18 20:45:21 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set bail on;
declare external function sright
varchar(100) by descriptor, smallint,
varchar(100) by descriptor returns parameter 3
entry_point 'right' module_name 'fbudf';
commit;
set list on;
2022-01-18 20:45:21 +01:00
select
rdb$function_name
2021-04-26 20:07:00 +02:00
,rdb$function_type
,rdb$module_name
,rdb$entrypoint
,rdb$return_argument
,rdb$system_flag
,rdb$legacy_flag
from rdb$functions where upper(rdb$function_name) = upper('sright');
select sright('qwerty', 2) as sright_result from rdb$database;
commit;
drop external function sright;
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
expected_stdout = """
RDB$FUNCTION_NAME SRIGHT
2021-04-26 20:07:00 +02:00
RDB$FUNCTION_TYPE <null>
RDB$MODULE_NAME fbudf
2022-01-18 20:45:21 +01:00
RDB$ENTRYPOINT right
2021-04-26 20:07:00 +02:00
RDB$RETURN_ARGUMENT 3
RDB$SYSTEM_FLAG 0
RDB$LEGACY_FLAG 1
SRIGHT_RESULT ty
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0,<4.0')
2022-01-18 20:45:21 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout