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

128 lines
3.0 KiB
Python

#coding:utf-8
"""
ID: issue-6145-A
ISSUE: 6145
TITLE: Allow the use of management statements in PSQL blocks
DESCRIPTION:
1. Currently test checks only ability to use SYNTAX for usage statements within PSQL blocks
as it is described in '...\\doc\\sql.extensions\\README.management_statements_psql.md'.
Actual affects on further work are not verified.
2. Deferred check of 'alter session reset': got SQLSTATE = 25000/no transaction for request.
Sent letter to dimitr et al, 09-mar-2019 13:43.
3. Deferred check of 'SET TRUSTED ROLE': it is unclear for me how to implement this.
Sent Q to Alex (same letter).
All other cases are checked on 4.0.0.1421 and 4.0.0.1457: OK.
NOTES:
[10.12.2019]
Updated syntax for SET BIND. Removed (maybe temply) check of 'set time zone bind native'.
Commits that changed syntax:
https://github.com/FirebirdSQL/firebird/commit/ca5ee672ca3144303732d5e2b5886b32c442da91 // 08-nov-19
https://github.com/FirebirdSQL/firebird/commit/08096e3b879811d0e2e87b707b260c17d1542167 // 12-dec-19
JIRA: CORE-5887
FBTEST: bugs.core_5887
"""
import pytest
from firebird.qa import *
db = db_factory()
test_script = """
set bail on;
set term ^;
execute block as
begin
begin
execute statement 'drop role acnt';
when any do begin end
end
end
^
set term ;^
commit;
create role acnt;
commit;
grant acnt to sysdba;
commit;
----------------------------------------------
-- NO output should be produced by further PSQL blocks:
set term ^;
execute block as
begin
set decfloat round ceiling;
end^
execute block as
begin
set decfloat traps to Division_by_zero, Invalid_operation, Overflow;
end^
execute block as
begin
-- OLD SYNTAX: set decfloat bind native;
-- Syntax after 11-nov-2019:
-- https://github.com/FirebirdSQL/firebird/commit/a77295ba153e0c17061e2230d0ffdbaf08839114
-- See also: doc/sql.extensions/README.set_bind.md:
-- SET BIND OF type-from TO { type-to | LEGACY };
-- SET BIND OF type NATIVE;
set bind of decfloat to native;
-- ^^
-- +--- since 12-dec-2019
end^
execute block as
begin
set role acnt;
end^
execute block as
begin
set session idle timeout 5 minute;
end^
execute block as
begin
set statement timeout 1 minute;
end^
execute block as
begin
set time zone local;
end^
execute block as
begin
set bind of timestamp with time zone to legacy;
set bind of time with time zone to legacy;
end^
^
execute block as
begin
set bind of timestamp with time zone to native;
set bind of time with time zone to native;
end^
^
set term ;^
commit;
drop role acnt;
commit;
"""
act = isql_act('db', test_script)
@pytest.mark.version('>=4.0')
def test_1(act: Action):
act.execute()