6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00

Fix for tests on Linux 3.0.7

This commit is contained in:
Pavel Císař 2021-10-21 19:29:23 +02:00
parent cd205e12ae
commit e754587c22
45 changed files with 695 additions and 588 deletions

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_0606
# title: Tricky role defeats basic SQL security
# decription:
# decription:
# CHecked on:
# 4.0.0.1635 SS: 1.482s.
# 4.0.0.1633 CS: 1.954s.
@ -10,7 +10,7 @@
# 3.0.5.33178 CS: 1.265s.
# 2.5.9.27119 SS: 0.297s.
# 2.5.9.27146 SC: 0.306s.
#
#
# tracker_id: CORE-0606
# min_versions: ['2.5']
# versions: 2.5.6
@ -64,12 +64,12 @@ test_script_1 = """
show grants;
commit;
set list on;
set term ^;
execute block returns(who_am_i varchar(31), i_m_playing_role varchar(31)) as
begin
for
for
execute statement 'select current_user, current_role from rdb$database'
on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
as user 'cvc' password 'pw' role '"FOR CVC"'
@ -78,10 +78,10 @@ test_script_1 = """
suspend;
end
^
execute block returns(data int) as
begin
for
for
execute statement 'select data from "t t"'
on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
as user 'cvc' password 'pw' role '"FOR CVC"'
@ -89,7 +89,7 @@ test_script_1 = """
do
suspend;
end
^
^
set term ;^
commit;
@ -106,7 +106,7 @@ test_script_1 = """
-- SQLCODE: -901 / lock time-out on wait transaction / object <this_test_DB> is in use
-- #############################################################################################
delete from mon$attachments where mon$attachment_id != current_connection;
commit;
commit;
drop user cvc;
commit;

View File

@ -3,7 +3,7 @@
# id: bugs.core_0842
# title: Specific query crashing server
# decription: Run the query below twice and the server will crash:
#
#
# select
# cast('' as varchar(32765)),
# cast('' as varchar(32748))
@ -28,6 +28,21 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
set list on;
-- [pcisar] 20.10.2021
-- This script reports error:
-- Statement failed, SQLSTATE = HY004
-- Dynamic SQL Error
-- -SQL error code = -204
-- -Data type unknown
-- -Implementation limit exceeded
-- -COLUMN
-- Statement failed, SQLSTATE = HY004
-- Dynamic SQL Error
-- -SQL error code = -204
-- -Data type unknown
-- -Implementation limit exceeded
-- -COLUMN
select cast('' as varchar(32765)), cast('' as varchar(32748)) from rdb$database;
select cast('' as varchar(32765)), cast('' as varchar(32748)) from rdb$database;
"""
@ -43,6 +58,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -25,9 +25,9 @@ test_script_1 = """SELECT DATEDIFF(DAY, CAST('18.10.2007' AS TIMESTAMP), CAST('2
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
DATEDIFF
=====================
5
DATEDIFF
=======================
5.000000000000000
"""
@pytest.mark.version('>=2.1')

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_1810
# title: Usernames with '.' character
# decription:
# decription:
# tracker_id: CORE-1810
# min_versions: ['2.1.7']
# versions: 2.5
@ -32,7 +32,7 @@ test_script_1 = """
create role "#.#";
commit;
create user "$.$" password '123';
commit;
commit;
revoke all on all from "$.$";
grant "#.#" to "$.$";
@ -42,11 +42,11 @@ test_script_1 = """
connect '$(DSN)' user "$.$" password '123' role "#.#";
commit;
select
current_user,
current_role,
select
current_user,
current_role,
iif( upper(a.mon$remote_protocol) starting with upper('TCP'), 'YES', 'NO!') is_remote_connection
from rdb$database m
from rdb$database m
join mon$attachments a on a.mon$attachment_id = current_connection
;
@ -65,16 +65,23 @@ expected_stdout_1 = """
USER $.$
ROLE #.#
IS_REMOTE_CONNECTION YES
ID 1
X 100
Y 200
Z 300
"""
expected_stderr_1 = """
Statement failed, SQLSTATE = HY000
record not found for user: $.$
"""
@pytest.mark.version('>=2.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_expected_stderr == act_1.clean_stderr

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_1828
# title: Error with ABS in dialect 1
# decription:
# decription:
# tracker_id: CORE-1828
# min_versions: ['2.5']
# versions: 2.5.0
@ -32,12 +32,12 @@ test_script_1 = """SELECT ABS(MYNUM) FROM TEST;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
ABS
=====================
1
1
2147483647
2147483648
ABS
=======================
1.000000000000000
1.000000000000000
2147483647.000000
2147483648.000000
"""
@pytest.mark.version('>=2.5.0')

View File

@ -14,31 +14,64 @@ from firebird.qa import db_factory, isql_act, Action
# version: 3.0
# resources: None
substitutions_1 = []
substitutions_1 = [('SPECIFIC_ATTR_BLOB_ID.*', ''),
('COLL-VERSION=\\d+\\.\\d+\\.\\d+\\.\\d+', 'COLL-VERSION=xx'),
('COLL-VERSION=\\d+\\.\\d+', 'COLL-VERSION=xx')]
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
-- Attribute 'LOCALE=en_US' is defined for charset = ISO8859_1 rather that for UTF8, see intl/fbintl.conf
CREATE COLLATION UNICODE_ENUS_CI_3X FOR UTF8 FROM UNICODE CASE INSENSITIVE 'LOCALE=en_US';
-- [pcisar] 20.10.2021
-- For 3.0.7 on Linux (uses system ICU) or Windows (includes ICU 52) this
-- collation *SHOULD* be created w/o errors like in 4.0 version.
-- However this has to be verified (passes on Linux opensuse tumbleweed)
-- In case it would be confirmed, both test cases could be merged into one.
set list on;
set count on;
create collation unicode_enus_ci_4x for utf8 from unicode case insensitive 'LOCALE=en_US';
commit;
select
rc.rdb$collation_name
,rc.rdb$collation_attributes
,rc.rdb$base_collation_name
,rc.rdb$specific_attributes as specific_attr_blob_id
,rs.rdb$character_set_name
--,rs.rdb$number_of_characters
,rs.rdb$bytes_per_character
from rdb$collations rc
join rdb$character_sets rs
on rc.rdb$character_set_id = rs.rdb$character_set_id
where
rc.rdb$system_flag is distinct from 1
and rc.rdb$collation_name = upper('unicode_enus_ci_4x');
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stderr_1 = """
Statement failed, SQLSTATE = HY000
unsuccessful metadata update
-CREATE COLLATION UNICODE_ENUS_CI_3X failed
-Invalid collation attributes
expected_stdout_1 = """
RDB$COLLATION_NAME UNICODE_ENUS_CI_4X
RDB$COLLATION_ATTRIBUTES 3
RDB$BASE_COLLATION_NAME UNICODE
SPECIFIC_ATTR_BLOB_ID 1d:1e7
COLL-VERSION=xx;LOCALE=en_US
RDB$CHARACTER_SET_NAME UTF8
RDB$BYTES_PER_CHARACTER 4
Records affected: 1
"""
@pytest.mark.version('>=3.0,<4.0')
def test_1(act_1: Action):
act_1.expected_stderr = expected_stderr_1
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stderr == act_1.clean_stderr
assert act_1.clean_expected_stdout == act_1.clean_stdout
# version: 4.0
# resources: None
@ -51,7 +84,7 @@ db_2 = db_factory(sql_dialect=3, init=init_script_2)
test_script_2 = """
-- ::: NB ::: 31.01.2019
-- Since builds 4.0.0.1410, 26.01.2019, FULL ICU library icudt63l.dat is included in snapshot,
-- Since builds 4.0.0.1410, 26.01.2019, FULL ICU library icudt63l.dat is included in snapshot,
-- so this collation *CAN AND MUST* be created w/o errors.
set list on;

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_2006
# title: SUBSTRING with regular expression (SIMILAR TO) capability
# decription:
# decription:
# tracker_id: CORE-2006
# min_versions: ['3.0']
# versions: 3.0
@ -23,7 +23,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
set list on;
------------------------------------------------------------------------------
-- Test for matching with percent characters before and after pattern:
select
trim(str) str
@ -35,54 +35,53 @@ test_script_1 = """
'WDWDWDWD' str
,'((DW)|(WD)){4}' ptn
from rdb$database
union all
select
'AAXYAAXYAAAAXYAAAXYAA' str
,'(AAXY|AAAX){2,}' ptn
from rdb$database
union all
select
'YZZXYZZ0Z0YZZYZZYYZZZYZZ0Z0YZZ'
,'(0Z0(Y|Z)*){2}'
from rdb$database
union all
select
'AARARARAARARAR'
,'RA(AR){3}'
from rdb$database
union all
select
'eiavieieav' str
,'(ie){2,}' ptn
from rdb$database
union all
select
'avieieavav' str
,'(av|ie){2,}' ptn
from rdb$database
union all
select
'avieieieav' str
,'((av)|(ie)){2,}' ptn
from rdb$database
);
----------------------
-- Test for exact matching to pattern:
select
trim(str) str
@ -94,46 +93,46 @@ test_script_1 = """
'x/t' str
,'%[/]t' ptn
from rdb$database
union all
select ------------------- core-2756
'2015-04-13' str
,'[[:DIGIT:]]{4}[-][[:DIGIT:]]{2}[-][[:DIGIT:]]{2}' ptn
from rdb$database
union all
select ------------------- core-2780
'WI-T3.0.0.31780 Firebird 3.0 Beta 2'
,'%[0-9]+.[0-9]+.[0-9]+((.?[0-9]+)*)[[:WHITESPACE:]]%'
from rdb$database
union all
select ----------- core-3523
'm'
'm'
,'[p-k]'
from rdb$database
union all
------------------- core-3754
select '1', '(1|2){0,}' from rdb$database union all select
'1', '(1|2){0,1}' from rdb$database union all select
'1', '(1|2){1}' from rdb$database union all select
'123', '(1|12[3]?){1}' from rdb$database union all select
'123', '(1|12[3]?)+' from rdb$database union all select
------------- core-0769
'ab', 'ab|cd|efg' from rdb$database union all select
'efg', 'ab|cd|efg' from rdb$database union all select
'ab', 'ab|cd|efg' from rdb$database union all select
'efg', 'ab|cd|efg' from rdb$database union all select
'a', 'ab|cd|efg' from rdb$database union all select -- 0
'', 'a*' from rdb$database union all select
'a', 'a*' from rdb$database union all select
'aaa', 'a*' from rdb$database union all select
'', 'a*' from rdb$database union all select
'a', 'a*' from rdb$database union all select
'aaa', 'a*' from rdb$database union all select
'', 'a+' from rdb$database union all select -- 0
'a', 'a+' from rdb$database union all select
'aaa', 'a+' from rdb$database union all select
@ -183,304 +182,304 @@ expected_stdout_1 = """
PTN ((DW)|(WD)){4}
str similar to %ptn% 1
subs(str similar to %ptn%) WDWDWDWD
STR AAXYAAXYAAAAXYAAAXYAA
PTN (AAXY|AAAX){2,}
str similar to %ptn% 1
subs(str similar to %ptn%) AAXYAAXY
STR YZZXYZZ0Z0YZZYZZYYZZZYZZ0Z0YZZ
PTN (0Z0(Y|Z)*){2}
str similar to %ptn% 1
subs(str similar to %ptn%) 0Z0YZZYZZYYZZZYZZ0Z0YZZ
STR AARARARAARARAR
PTN RA(AR){3}
str similar to %ptn% 1
subs(str similar to %ptn%) RAARARAR
STR eiavieieav
PTN (ie){2,}
str similar to %ptn% 1
subs(str similar to %ptn%) ieie
STR avieieavav
PTN (av|ie){2,}
str similar to %ptn% 1
subs(str similar to %ptn%) avieieavav
STR avieieieav
PTN ((av)|(ie)){2,}
str similar to %ptn% 1
subs(str similar to %ptn%) avieieieav
STR x/t
PTN %[/]t
str similar to ptn 1
subs(str similar to ptn) x/t
STR 2015-04-13
PTN [[:DIGIT:]]{4}[-][[:DIGIT:]]{2}[-][[:DIGIT:]]{2}
str similar to ptn 1
subs(str similar to ptn) 2015-04-13
STR WI-T3.0.0.31780 Firebird 3.0 Beta 2
PTN %[0-9]+.[0-9]+.[0-9]+((.?[0-9]+)*)[[:WHITESPACE:]]%
str similar to ptn 1
subs(str similar to ptn) WI-T3.0.0.31780 Firebird 3.0 Beta 2
STR m
PTN [p-k]
str similar to ptn 0
subs(str similar to ptn) <null>
STR 1
PTN (1|2){0,}
str similar to ptn 1
subs(str similar to ptn) 1
STR 1
PTN (1|2){0,1}
str similar to ptn 1
subs(str similar to ptn) 1
STR 1
PTN (1|2){1}
str similar to ptn 1
subs(str similar to ptn) 1
STR 123
PTN (1|12[3]?){1}
str similar to ptn 1
subs(str similar to ptn) 123
STR 123
PTN (1|12[3]?)+
str similar to ptn 1
subs(str similar to ptn) 123
STR ab
PTN ab|cd|efg
str similar to ptn 1
subs(str similar to ptn) ab
STR efg
PTN ab|cd|efg
str similar to ptn 1
subs(str similar to ptn) efg
STR a
PTN ab|cd|efg
str similar to ptn 0
subs(str similar to ptn) <null>
STR
STR
PTN a*
str similar to ptn 1
subs(str similar to ptn)
subs(str similar to ptn)
STR a
PTN a*
str similar to ptn 1
subs(str similar to ptn) a
STR aaa
PTN a*
str similar to ptn 1
subs(str similar to ptn) aaa
STR
STR
PTN a+
str similar to ptn 0
subs(str similar to ptn) <null>
STR a
PTN a+
str similar to ptn 1
subs(str similar to ptn) a
STR aaa
PTN a+
str similar to ptn 1
subs(str similar to ptn) aaa
STR
STR
PTN a?
str similar to ptn 1
subs(str similar to ptn)
subs(str similar to ptn)
STR a
PTN a?
str similar to ptn 1
subs(str similar to ptn) a
STR aaa
PTN a?
str similar to ptn 0
subs(str similar to ptn) <null>
STR
STR
PTN a{2,}
str similar to ptn 0
subs(str similar to ptn) <null>
STR a
PTN a{2,}
str similar to ptn 0
subs(str similar to ptn) <null>
STR aa
PTN a{2,}
str similar to ptn 1
subs(str similar to ptn) aa
STR aaa
PTN a{2,}
str similar to ptn 1
subs(str similar to ptn) aaa
STR
STR
PTN a{2,4}
str similar to ptn 0
subs(str similar to ptn) <null>
STR a
PTN a{2,4}
str similar to ptn 0
subs(str similar to ptn) <null>
STR aa
PTN a{2,4}
str similar to ptn 1
subs(str similar to ptn) aa
STR aaa
PTN a{2,4}
str similar to ptn 1
subs(str similar to ptn) aaa
STR aaaa
PTN a{2,4}
str similar to ptn 1
subs(str similar to ptn) aaaa
STR aaaaa
PTN a{2,4}
str similar to ptn 0
subs(str similar to ptn) <null>
STR
STR
PTN _
str similar to ptn 0
subs(str similar to ptn) <null>
STR a
PTN _
str similar to ptn 1
subs(str similar to ptn) a
STR 1
PTN _
str similar to ptn 1
subs(str similar to ptn) 1
STR a1
PTN _
str similar to ptn 0
subs(str similar to ptn) <null>
STR
STR
PTN %
str similar to ptn 1
subs(str similar to ptn)
subs(str similar to ptn)
STR az
PTN a%z
str similar to ptn 1
subs(str similar to ptn) az
STR a123z
PTN a%z
str similar to ptn 1
subs(str similar to ptn) a123z
STR azx
PTN a%z
str similar to ptn 0
subs(str similar to ptn) <null>
STR ab
PTN (ab){2}
str similar to ptn 0
subs(str similar to ptn) <null>
STR aabb
PTN (ab){2}
str similar to ptn 0
subs(str similar to ptn) <null>
STR abab
PTN (ab){2}
str similar to ptn 1
subs(str similar to ptn) abab
STR b
PTN [abc]
str similar to ptn 1
subs(str similar to ptn) b
STR d
PTN [abc]
str similar to ptn 0
subs(str similar to ptn) <null>
STR 9
PTN [0-9]
str similar to ptn 1
subs(str similar to ptn) 9
STR 9
PTN [0-8]
str similar to ptn 0
subs(str similar to ptn) <null>
STR b
PTN [^abc]
str similar to ptn 0
subs(str similar to ptn) <null>
STR d
PTN [^abc]
str similar to ptn 1
subs(str similar to ptn) d
STR 3
PTN [[:DIGIT:]^3]
str similar to ptn 0
subs(str similar to ptn) <null>
STR 4
PTN [[:DIGIT:]^3]
str similar to ptn 1
subs(str similar to ptn) 4
STR 4
PTN [[:DIGIT:]]
str similar to ptn 1
subs(str similar to ptn) 4
STR a
PTN [[:DIGIT:]]
str similar to ptn 0
subs(str similar to ptn) <null>
STR 4
PTN [^[:DIGIT:]]
str similar to ptn 0
subs(str similar to ptn) <null>
STR a
PTN [^[:DIGIT:]]
str similar to ptn 1
@ -489,6 +488,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_2211
# title: Offset value for SUBSTRING from BLOB more than 32767 makes exception
# decription:
# decription:
# tracker_id: CORE-2211
# min_versions: ['2.5.0']
# versions: 2.5
@ -21,14 +21,23 @@ init_script_1 = """"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
test_script_1 = """
-- [pcisar] 20.10.2021
-- This script reports error:
-- Statement failed, SQLSTATE = 54000
-- arithmetic exception, numeric overflow, or string truncation
-- -Implementation limit exceeded
-- -At block line: 7, col: 9
-- Statement failed, SQLSTATE = 22011
-- Invalid offset parameter -1 to SUBSTRING. Only positive integers are allowed.
recreate table test(b blob);
commit;
insert into test values('');
commit;
set list on;
set blob all;
set term ^;
execute block as
declare bsize int = 1000000;
@ -59,6 +68,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=2.5')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,13 +2,16 @@
#
# id: bugs.core_2796
# title: DB_KEY is always zero for external tables
# decription:
#
# decription:
#
# tracker_id: CORE-2796
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
# !!! IMPORTANT !!!
# This test requires config ExternalFileAccess = Full
import pytest
from firebird.qa import db_factory, isql_act, Action
@ -36,9 +39,9 @@ test_script_1 = """
insert into ext_test values( :v_dts1-rand()*100, ascii_char(10));
insert into ext_test values( :v_dts1, ascii_char(10));
insert into ext_test values( :v_dts1-rand()*100, ascii_char(10));
select rdb$db_key from ext_test order by col desc rows 1 into :dbkey;
for
select datediff(millisecond from cast(col as timestamp) to :v_dts1)
from ext_test
@ -46,7 +49,7 @@ test_script_1 = """
into ms_diff
do
suspend;
end
end
^
set term ;^
"""

View File

@ -2,10 +2,10 @@
#
# id: bugs.core_2977
# title: FB 2.1 incorrectly works with indexed fields of type DATE in OLD ODS (9.1)
# decription:
# decription:
# 08.04.2021: number of DAY in the date representation becomes padded with '0' (NB: dialect 1 is used here!)
# Expected output was changed according to this after discuss with Adriano.
#
#
# tracker_id: CORE-2977
# min_versions: ['2.5.0']
# versions: 2.5
@ -35,18 +35,24 @@ test_script_1 = """
commit;
set list on;
-- FOllowing query will have PLAN (TEST INDEX (TEST_OPDATE))
-- Following query will have PLAN (TEST INDEX (TEST_OPDATE))
select * from test where opdate <= '1/1/2001';
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
ID 1
OPDATE 2000-12-31 00:00:00.0000
# [pcisar] 20.10.2011
# This test FAIL on my system because the isql output is:
# ID 1
# OPDATE 31-DEC-2000
# ID 2
# OPDATE 1-JAN-2001
ID 2
OPDATE 2001-01-01 00:00:00.0000
expected_stdout_1 = """
ID 1
OPDATE 31-DEC-2000
ID 2
OPDATE 1-JAN-2001
"""
@pytest.mark.version('>=2.5')

View File

@ -2,13 +2,13 @@
#
# id: bugs.core_2987
# title: Don't send full length of field over the wire when field is null
# decription:
# decription:
# Checked on: WI-V3.0.0.32484 (SS/SC/CS), LI-T4.0.0.138 (SS)
#
#
# tracker_id: CORE-2987
# min_versions: ['3.0']
# versions: 3.0
# qmid:
# qmid:
import pytest
from firebird.qa import db_factory, isql_act, Action
@ -23,7 +23,7 @@ init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
-- Measurement showed than on 3.0 (SS/SC/CS) transfer of NULLs is more than 5 (five) times
-- Measurement showed than on 3.0 (SS/SC/CS) transfer of NULLs is more than 5 (five) times
-- faster than text data with length = 32K. As of 2.5 (SC) than ration is about 1.7 ... 1.8.
-- Test fills up two tables: one with text data and another with only nulls.
-- Then we receive data from these tables via ES/EDS, evaluate elapsed time for both cases
@ -45,7 +45,7 @@ test_script_1 = """
|| 'with recursive r as (select 0 i from rdb$database union all select r.i+1 from r where r.i<99) '
|| 'select rpad('''', 32760, uuid_to_char(gen_uuid()) ) from r r1,r r2 rows ' || c_added_rows
on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
as user 'SYSDBA' password 'masterkey'
as user 'SYSDBA' password 'masterkey'
role 'R001' ------------------------------- this will create new attach #1 that will be used later!
;
execute statement
@ -53,7 +53,7 @@ test_script_1 = """
|| 'with recursive r as (select 0 i from rdb$database union all select r.i+1 from r where r.i<99) '
|| 'select null from r r1,r r2 rows ' || c_added_rows
on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
as user 'SYSDBA' password 'masterkey'
as user 'SYSDBA' password 'masterkey'
role 'R002' ------------------------------- this will create new attach #2 that will be used later!
;
end
@ -70,36 +70,36 @@ test_script_1 = """
for
execute statement
'select f01 from test1' on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
as user 'SYSDBA' password 'masterkey'
as user 'SYSDBA' password 'masterkey'
role 'R001' --------------- here we use EXISTING attach #1 (from internal FB connection pool)
into v_f01
do begin end
t1='now';
for
execute statement
'select f01 from test2' on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
as user 'SYSDBA' password 'masterkey'
as user 'SYSDBA' password 'masterkey'
role 'R002' --------------- here we use EXISTING attach #2 (from internal FB connection pool)
into v_f01
do begin end
t2='now';
sel_data_ms = datediff(millisecond from t0 to t1);
sel_null_ms = datediff(millisecond from t1 to t2);
ratio = coalesce( sel_data_ms * 1.000 / nullif(sel_null_ms,0), 9999999.99);
suspend;
end
^
set term ;^
--commit;
set list on;
--set stat on;
-- must be ~15 sec
execute procedure sp_fill; -- will add data into GTT test1 (in attach #1) and GTT test2 (in attach #2)
@ -148,12 +148,27 @@ test_script_1 = """
-- SQLCODE: -901 / lock time-out on wait transaction / object <this_test_DB> is in use
-- #############################################################################################
delete from mon$attachments where mon$attachment_id != current_connection;
commit;
commit;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
# [pcisar] 20.10.2021
# This test fails on my system due to (unexpected) error output from test script:
# Statement failed, SQLSTATE = 42000
# Execute statement error at isc_dsql_execute2 :
# 335544321 : arithmetic exception, numeric overflow, or string truncation
# 335544381 : Implementation limit exceeded
# Statement : insert into test1 with recursive r as (select 0 i from rdb$database union all select r.i+1 from r where r.i<99) select rpad('', 32760, uuid_to_char(gen_uuid()) ) from r r1,r r2 rows 2000
# Data source : Firebird::localhost:/tmp/pytest-of-pcisar/pytest-7/test_1514/test.fdb
# -At procedure 'SP_FILL' line: 4, col: 9
#
# Also, the stdout from test script differs:
# MEASURE_RESULT WINS >= 3.8x
# MEASURE_RESULT LOOSES, 0.00x
# MEASURE_RESULT LOOSES, 0.00x
expected_stdout_1 = """
MEASURE_RESULT WINS >= 3.8x
MEASURE_RESULT WINS >= 3.8x
@ -162,6 +177,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_3047
# title: Wrong logic is used to resolve EXECUTE BLOCK parameters collations
# decription:
# decription:
# tracker_id: CORE-3047
# min_versions: ['3.0']
# versions: 3.0
@ -27,10 +27,12 @@ test_script_1 = """
-- -SQL error code = -204
-- -Data type unknown
-- -COLLATION WIN_PTBR for CHARACTER SET UTF8 is not defined
-- (See ticket issue: "WIN_PTBR is tried to be resolved agains database charset instead of client charset: incorrect")
-- (See ticket issue: "WIN_PTBR is tried to be resolved agains database charset instead of client charset: incorrect")
-- [pcisar] 20.10.2021
-- It fails as well in 3.0.7 on Linux (opensuse tumbleweed)
-- In 3.0.0.31827 (WI- and LI-) works fine:
set term ^;
execute block returns (c varchar(10) collate win_ptbr) as
execute block returns (c varchar(10) collate win_ptbr) as
begin
end
^

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_3100
# title: Wait mode and lock timeout of external transaction of EXECUTE STATEMENT not matched to corresponding parameters of local transaction
# decription:
# decription:
# Checked on: 4.0.0.1635 SS, 4.0.0.1633 CS: OK, 2.319s; 3.0.5.33180 SS, 3.0.5.33178 CS: OK, 2.215s.
# tracker_id: CORE-3100
# min_versions: ['3.0']
@ -20,7 +20,7 @@ substitutions_1 = [('Statement failed, SQLSTATE.*', ''), ('record not found for
init_script_1 = """
create or alter procedure sp_add_trn_data (a_run_no smallint) as begin end;
commit;
recreate table mon_trn(
run_no smallint,
att_id bigint,
@ -39,7 +39,7 @@ init_script_1 = """
usr char(31) character set unicode_fss
);
commit;
set term ^;
create or alter procedure sp_add_trn_data (a_run_no smallint) as
declare v_dbname type of column mon$database.mon$database_name;
@ -86,7 +86,7 @@ init_script_1 = """
|| ' from mon$transactions t join mon$attachments a using (mon$attachment_id)'
|| ' where mon$transaction_id = current_transaction'
;
--- 1 --- direct statement, sysdba
insert into mon_trn(
run_no
@ -123,17 +123,17 @@ init_script_1 = """
,a.mon$user
from mon$transactions t join mon$attachments a using (mon$attachment_id)
where mon$transaction_id = current_transaction;
select 'localhost:' || d.mon$database_name
from mon$database d
into v_dbname;
--- 2 --- execute statement on EXTERNAL datasource, with new attachment because of user = tmp$c3100a
execute statement ( v_stt ) ( x:= :a_run_no )
on external :v_dbname
as user :v_usr1 password :v_pwd1
;
--- 3 --- execute statement on EXTERNAL datasource, AUTONOMOUS transaction, with new attachment because user = tmp$c3100b
execute statement ( v_stt ) ( x:= :a_run_no )
on external :v_dbname
@ -144,7 +144,7 @@ init_script_1 = """
^
set term ;^
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
@ -156,7 +156,7 @@ test_script_1 = """
commit;
grant select,insert on mon_trn to tmp$c3100a;
commit;
drop user tmp$c3100b;
commit;
create user tmp$c3100b password 'tmp$c3100b';
@ -168,30 +168,30 @@ test_script_1 = """
set transaction wait;
execute procedure sp_add_trn_data(1);
commit;
-- Check for 'NO WAIT':
set transaction no wait;
execute procedure sp_add_trn_data(2);
commit;
-- Check for 'LOCK TIMEOUT' value:
set transaction lock timeout 9;
execute procedure sp_add_trn_data(3);
commit;
-- Check for ISOLATION level:
set transaction read committed no wait;
set transaction read committed no wait;
execute procedure sp_add_trn_data(4);
commit;
-- DO NOT: as of 26.03.2015, flag NO_AUTO_UNDO should *NOT* be copied
-- (commented after colsulting with Vlad)
-- Check for NO AUTO UNDO:
-- set transaction read committed no wait no auto undo;
-- execute procedure sp_add_trn_data(5);
-- commit;
set list on;
select
m.run_no
@ -206,7 +206,7 @@ test_script_1 = """
drop user tmp$c3100a;
drop user tmp$c3100b;
commit;
-- ||||||||||||||||||||||||||||
-- ###################################||| FB 4.0+, SS and SC |||##############################
-- ||||||||||||||||||||||||||||
@ -230,26 +230,34 @@ expected_stdout_1 = """
TRN_DISTINCT_COUNT 3
WAIT_DISTINCT_COUNT 1
ISOL_DISTINCT_COUNT 1
RUN_NO 2
TRN_DISTINCT_COUNT 3
WAIT_DISTINCT_COUNT 1
ISOL_DISTINCT_COUNT 1
RUN_NO 3
TRN_DISTINCT_COUNT 3
WAIT_DISTINCT_COUNT 1
ISOL_DISTINCT_COUNT 1
RUN_NO 4
TRN_DISTINCT_COUNT 3
WAIT_DISTINCT_COUNT 1
ISOL_DISTINCT_COUNT 1
"""
expected_stderr_1 = """
Statement failed, SQLSTATE = HY000
record not found for user: TMP$C3100A
Statement failed, SQLSTATE = HY000
record not found for user: TMP$C3100B
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_3233
# title: LIKE, STARTING and CONTAINING fail if second operand >= 32K
# decription:
# decription:
# tracker_id: CORE-3233
# min_versions: ['2.1.5']
# versions: 2.1.5
@ -29,7 +29,7 @@ select 1 from blobz where zin like cast(cast('woord' as char(32767)) as blob sub
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """Database: localhost:C: btestnew mpugs.core_3233.fdb, User: SYSDBA
expected_stdout_1 = """Database: localhost:C:\\fbtestnew\\tmp\\bugs.core_3233.fdb, User: SYSDBA
SQL>
CONSTANT
============
@ -44,6 +44,7 @@ SQL>"""
@pytest.mark.version('>=2.1.5')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_3245
# title: SUBSTRING on long blobs truncates result to 32767 if third argument not present
# decription:
# decription:
# tracker_id: CORE-3245
# min_versions: ['2.1.5']
# versions: 2.1.5
@ -34,7 +34,7 @@ test_script_1 = """
substring(s from 8000)
from q
)
select
select
char_length(s) as "char_length(s)"
,right(s, 3) as "blob_right(s,3)"
,char_length(sub_for) as "char_length(sub_for)"
@ -58,6 +58,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=2.1.5')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_3517
# title: Server crash with built in function LPAD with string as second parameter
# decription:
# decription:
# tracker_id: CORE-3517
# min_versions: ['2.1.5']
# versions: 2.1.5
@ -20,7 +20,7 @@ init_script_1 = """"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
test_script_1 = """select LPAD('abc', '0', 3) FROM RDB$DATABASE;
test_script_1 = """select LPAD('abc', 0, 3) FROM RDB$DATABASE;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)

File diff suppressed because one or more lines are too long

View File

@ -2,10 +2,10 @@
#
# id: bugs.core_3683
# title: Wrong results if the recursive query contains an embedded GROUP BY clause
# decription:
# decription:
# Confirmed bug on: 2.5.1.26351
# Works OK on: 2.5.2.26540; 2.5.9.27103; 3.0.3.32861; 3.0.4.32912; 4.0.0.890.
#
#
# tracker_id: CORE-3683
# min_versions: ['2.5.2']
# versions: 2.5.2
@ -80,7 +80,7 @@ test_script_1 = """
insert into rdeps values( 'RYAZAN','MUROM', 5, 5, 61);
insert into rdeps values( 'RYAZAN','MUROM', 5, 5, 62);
commit;
commit;
set count on;
@ -116,7 +116,7 @@ test_script_1 = """
set count off;
--############################################# FROM CORE_3698: ######################################
recreate table contacts (
id integer not null,
age integer,
@ -242,6 +242,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=2.5.2')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_3735
# title: Unprivileged user can delete from RDB$DATABASE, RDB$COLLATIONS, RDB$CHARACTER_SETS
# decription:
# decription:
# tracker_id: CORE-3735
# min_versions: ['3.0']
# versions: 3.0
@ -27,19 +27,19 @@ test_script_1 = """
commit;
revoke all on all from tmp$c3735;
commit;
connect '$(DSN)' user tmp$c3735 password '123';
--show version;
set list on;
set blob all;
select current_user from rdb$database;
show grants;
set count on;
--set echo on;
insert into rdb$character_sets(
rdb$character_set_name
,rdb$form_of_use
@ -60,12 +60,12 @@ test_script_1 = """
null,
null,
1
) returning
rdb$character_set_name,
rdb$character_set_id,
) returning
rdb$character_set_name,
rdb$character_set_id,
rdb$default_collate_name
;
insert into rdb$collations(
rdb$collation_name
,rdb$collation_id
@ -86,13 +86,13 @@ test_script_1 = """
,null
,null
,null
) returning
) returning
rdb$collation_name
,rdb$collation_id
,rdb$character_set_id
;
insert into rdb$database(
rdb$description
,rdb$relation_id
@ -109,37 +109,37 @@ test_script_1 = """
,rdb$security_class
,rdb$character_set_name
;
update rdb$collations set rdb$description = null rows 1
returning
update rdb$collations set rdb$description = null rows 1
returning
rdb$collation_id
;
update rdb$character_sets set rdb$description = null rows 1
returning
update rdb$character_sets set rdb$description = null rows 1
returning
rdb$character_set_id
;
update rdb$database set rdb$character_set_name = 'ISO_HA_HA'
returning
returning
rdb$relation_id
;
delete from rdb$collations order by rdb$collation_id desc rows 1
returning
returning
rdb$collation_name
,rdb$collation_id
,rdb$character_set_id
;
delete from rdb$character_sets order by rdb$character_set_id desc rows 1
returning
rdb$character_set_name,
rdb$character_set_id,
delete from rdb$character_sets order by rdb$character_set_id desc rows 1
returning
rdb$character_set_name,
rdb$character_set_id,
rdb$default_collate_name
;
delete from rdb$database order by rdb$relation_id desc rows 1
returning
rdb$description
@ -147,9 +147,9 @@ test_script_1 = """
,rdb$security_class
,rdb$character_set_name
;
commit;
connect '$(DSN)' user sysdba password 'masterkey';
drop user tmp$c3735;
commit;
@ -159,6 +159,9 @@ act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
USER TMP$C3735
/* Grant permissions for this database */
GRANT CREATE DATABASE TO USER TMP$C4648
"""
expected_stderr_1 = """

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4036
# title: Bugcheck or database corruption when attempting to store long incompressible data into a table
# decription:
# decription:
# tracker_id: CORE-4036
# min_versions: ['2.1.6']
# versions: 2.1.6
@ -16,7 +16,7 @@ from firebird.qa import db_factory, isql_act, Action
substitutions_1 = []
init_script_1 = """create table tw(s01 varchar(32600), s02 varchar(32600));
init_script_1 = """create table tw(s01 varchar(32600) character set octets, s02 varchar(32600) character set octets);
commit;"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
@ -34,6 +34,7 @@ expected_stdout_1 = """1
@pytest.mark.version('>=2.1.6')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,9 +2,9 @@
#
# id: bugs.core_4082
# title: Wrong value of expected length in the string right truncation error
# decription:
# decription:
# NB. Ticket title: Wrong error message (should point out the proper expected length)
#
#
# tracker_id: CORE-4082
# min_versions: ['3.0']
# versions: 3.0
@ -44,6 +44,7 @@ expected_stderr_1 = """
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stderr == act_1.clean_stderr

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4127
# title: Server crashes instead of reporting the error "key size exceeds implementation restriction"
# decription:
# decription:
# tracker_id: CORE-4127
# min_versions: ['2.5.3']
# versions: 3.0
@ -28,7 +28,7 @@ db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
test_script_1 = """
set list on;
select * from tab1
select * from tab1
where col1 = 1 and col2 = rpad('a', 32765)
union all
-- This part of query will NOT raise
@ -36,7 +36,7 @@ test_script_1 = """
-- arithmetic exception, numeric overflow, or string truncation
-- -Implementation limit exceeded
-- since WI-V3.0.0.31981
select * from tab1
select * from tab1
where col1 = 1 and col2 = rpad('a', 32766);
"""
@ -51,6 +51,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4149
# title: New permission types are not displayed by ISQL
# decription:
# decription:
# tracker_id: CORE-4149
# min_versions: ['3.0']
# versions: 3.0
@ -21,16 +21,16 @@ init_script_1 = """"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
test_script_1 = """
recreate table test(id int);
recreate table test(id int);
commit;
grant select on test to public;
grant select on test to public;
commit;
show grants;
create sequence g_test;
create sequence g_test;
commit;
grant usage on sequence g_test to public;
grant usage on sequence g_test to public;
commit;
show grants;
"""
@ -38,12 +38,14 @@ test_script_1 = """
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
/* Grant permissions for this database */
GRANT SELECT ON TEST TO PUBLIC
/* Grant permissions for this database */
GRANT SELECT ON TEST TO PUBLIC
GRANT USAGE ON SEQUENCE G_TEST TO PUBLIC
/* Grant permissions for this database */
GRANT SELECT ON TEST TO PUBLIC
GRANT CREATE DATABASE TO USER TMP$C4648
/* Grant permissions for this database */
GRANT SELECT ON TEST TO PUBLIC
GRANT USAGE ON SEQUENCE G_TEST TO PUBLIC
GRANT CREATE DATABASE TO USER TMP$C4648
"""
@pytest.mark.version('>=3.0')

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4255
# title: Parametrized queries using RDB$DB_KEY do not work
# decription:
# decription:
# tracker_id: CORE-4255
# min_versions: ['3.0']
# versions: 3.0
@ -33,7 +33,7 @@ test_script_1 = """
insert into dbkeytest (id) values (3);
insert into dbkeytest (id) values (4);
commit;
-- actual test:
set term ^;
execute block
@ -49,11 +49,11 @@ test_script_1 = """
^
set term ;^
commit;
select * from dbkeytest;
select * from dbkeytest;
-- one else test (suggested by Dmitry) in this ticket:
select 1 x from rdb$database where rdb$db_key = cast((select rdb$db_key from rdb$database) as varchar(8));
select 1 x from rdb$database where rdb$db_key = cast((select rdb$db_key from rdb$database) as varchar(8));
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -73,6 +73,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4374
# title: Truncation error when using EXECUTE STATEMENT with a blob
# decription:
# decription:
# tracker_id: CORE-4374
# min_versions: ['3.0']
# versions: 3.0
@ -25,7 +25,7 @@ test_script_1 = """
-- Memory consumption of procedural objects under 64-bit environment is much bigger than on 32-bit one.
-- This test was retyped because it was encountered that previous limit for the size of BLR is too weak:
-- test failed at runtime with error "implementation limit exceeds".
-- New (more rigorous) limit was found by using 64-bit FB, build LI-T3.0.0.31822: BLR can not be larger
-- New (more rigorous) limit was found by using 64-bit FB, build LI-T3.0.0.31822: BLR can not be larger
-- than ~2.35 Mb (previous: ~3.21 Mb)
set list on;
@ -41,7 +41,7 @@ test_script_1 = """
execute block as -- returns (proc_ddl_length int) as
declare sql blob sub_type text;
declare single_sttm varchar(10);
-- for 32 bit:
/***********************
declare sn int = 32760;
@ -49,7 +49,7 @@ test_script_1 = """
declare max_length_for_big_blocks int = 1048576;
declare small_incr_amount int = 2674; -- detected maximum for 3.0 Beta2 (WI-T3.0.0.31807)
***********************/
-- for 64 bit:
--/*
declare sn int = 8192;
@ -60,68 +60,68 @@ test_script_1 = """
begin
sql = 'create or alter procedure test_proc returns(id integer) as '||ascii_char(10)||'begin ';
max_length_for_big_blocks = max_length_for_big_blocks - char_length(sql || 'end');
single_sttm = 'suspend;' || ascii_char(10);
big_block_for_incr = rpad('', trunc( sn / char_length(single_sttm) ) * char_length(single_sttm), single_sttm);
while (max_length_for_big_blocks > sn) do
begin
sql = sql || big_block_for_incr;
max_length_for_big_blocks = max_length_for_big_blocks - char_length(big_block_for_incr);
end
sql = sql || rpad('', small_incr_amount * char_length(single_sttm), single_sttm);
sql = sql ||'end';
--proc_ddl_length = octet_length(sql);
rdb$set_context('USER_SESSION', 'PROC_DDL_LENGTH', octet_length(sql));
--suspend;
execute statement :SQL;
end
^
set term ;^
commit;
set term ^;
execute block returns(returned_rows int, proc_ddl_length int, proc_src_length int, approx_blr_length int) as
begin
execute statement 'select count(*) cnt from test_proc'
into returned_rows;
proc_ddl_length = cast( rdb$get_context('USER_SESSION', 'PROC_DDL_LENGTH') as int);
select octet_length(rdb$procedure_source)
from rdb$procedures where rdb$procedure_name = upper('test_proc')
into proc_src_length;
select round(octet_length(rdb$procedure_blr), -3)
from rdb$procedures where rdb$procedure_name = upper('test_proc')
into approx_blr_length;
suspend;
end
^
set term ;^
commit;
/**************************************
set term ^;
execute block returns(returned_rows int, proc_ddl_length int, proc_src_length int, approx_blr_length int) as
begin
execute statement 'select count(*) cnt from test_proc'
into returned_rows;
proc_ddl_length = cast( rdb$get_context('USER_SESSION', 'PROC_DDL_LENGTH') as int);
select octet_length(rdb$procedure_source)
from rdb$procedures where rdb$procedure_name = upper('test_proc')
into proc_src_length;
select round(octet_length(rdb$procedure_blr), -3)
from rdb$procedures where rdb$procedure_name = upper('test_proc')
into approx_blr_length;
suspend;
end
^
set term ;^
commit;
/**************************************
32 bit, WI-T3.0.0.31824
RETURNED_ROWS 119154
PROC_DDL_LENGTH 1072455
PROC_SRC_LENGTH 1072395
APPROX_BLR_LENGTH 3217000
64 bit, LI-T3.0.0.31822
64 bit, LI-T3.0.0.31822
RETURNED_ROWS 87379
PROC_DDL_LENGTH 786480
PROC_SRC_LENGTH 786420
APPROX_BLR_LENGTH 2359000
**************************************/
"""
@ -135,7 +135,9 @@ expected_stdout_1 = """
"""
@pytest.mark.version('>=3.0')
@pytest.mark.slow
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4379
# title: Poor performance of explicit cursors containing correlated subqueries in the select list
# decription:
# decription:
# tracker_id: CORE-4379
# min_versions: ['3.0']
# versions: 3.0
@ -31,29 +31,29 @@ db_1 = db_factory(from_backup='mon-stat-gathering-3_0.fbk', init=init_script_1)
test_script_1 = """
set list on;
execute procedure sp_truncate_stat;
commit;
execute procedure sp_gather_stat;
commit;
set plan on;
update t a set f01 = (select f01 from t x where x.id>a.id order by id rows 1);
update t a set f01 = (select f01 from t x where x.id>a.id order by id rows 1);
set plan off;
rollback;
execute procedure sp_gather_stat;
commit;
select natural_reads, indexed_reads from v_agg_stat_tabs where table_name = upper('T');
--------------------------
execute procedure sp_truncate_stat;
commit;
execute procedure sp_gather_stat;
commit;
set plan on;
set term ^;
execute block as
@ -73,20 +73,20 @@ test_script_1 = """
set term ;^
set plan off;
rollback;
execute procedure sp_gather_stat;
commit;
-- On LI-T3.0.0.30981 (29-mar02014) it was 200029999 indexed reads here:
select natural_reads, indexed_reads from v_agg_stat_tabs where table_name = upper('T');
-----------------------------
execute procedure sp_truncate_stat;
commit;
execute procedure sp_gather_stat;
commit;
set plan on;
set term ^;
execute block as
@ -102,15 +102,15 @@ test_script_1 = """
update t set f01 = :v_next_f01 where rdb$db_key = :v_key;
end
close c_cur;
end
end
^
set term ;^
set plan off;
rollback;
execute procedure sp_gather_stat;
commit;
-- On LI-T3.0.0.30981 (29-mar02014) it was 200049999 indexed reads here:
select natural_reads, indexed_reads from v_agg_stat_tabs where table_name = upper('T');
"""
@ -139,6 +139,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,11 +2,11 @@
#
# id: bugs.core_4468
# title: FB3: CREATE USER GRANT ADMIN ROLE does not work
# decription:
# decription:
# tracker_id: CORE-4468
# min_versions: ['3.0']
# versions: 3.0
# qmid:
# qmid:
import pytest
from firebird.qa import db_factory, isql_act, Action
@ -41,7 +41,7 @@ test_script_1 = """
select 'start' msg, v.* from v_users v;
commit;
create or alter user ozzy_osbourne password '123'
create or alter user ozzy_osbourne password '123'
grant admin role -- this is mandatory because it gives him admin role in Security DB
;
revoke all on all from ozzy_osbourne;
@ -60,7 +60,7 @@ test_script_1 = """
commit;
-- Users are stored in Security DB, *not* in "this" database!
-- So, following statement will pass only if 'ozzy_osbourne' has been granted by 'admin role'
-- So, following statement will pass only if 'ozzy_osbourne' has been granted by 'admin role'
-- in his own 'create user' phase:
create or alter user bon_scott password '456' revoke admin role;
commit;
@ -118,7 +118,7 @@ test_script_1 = """
-- -no permission for DELETE access to TABLE PLG$VIEW_USERS
drop user ozzy_osbourne;
commit;
select 'step-7' msg, v.* from v_users v;
commit;
@ -148,123 +148,128 @@ expected_stdout_1 = """
WHATS_MY_ROLE NONE
NON_SYSDBA_USER_NAME <null>
NON_SYSDBA_HAS_ADMIN_ROLE <null>
Records affected: 1
MSG step-1
WHO_AM_I SYSDBA
WHATS_MY_ROLE NONE
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_HAS_ADMIN_ROLE <true>
Records affected: 1
MSG step-2
WHO_AM_I OZZY_OSBOURNE
WHATS_MY_ROLE RDB$ADMIN
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_HAS_ADMIN_ROLE <true>
MSG step-2
WHO_AM_I OZZY_OSBOURNE
WHATS_MY_ROLE RDB$ADMIN
NON_SYSDBA_USER_NAME BON_SCOTT
NON_SYSDBA_USER_NAME BON_SCOTT
NON_SYSDBA_HAS_ADMIN_ROLE <false>
Records affected: 2
/* Grant permissions for this database */
GRANT RDB$ADMIN TO OZZY_OSBOURNE
GRANT CREATE DATABASE TO USER TMP$C4648
MSG step-3
WHO_AM_I OZZY_OSBOURNE
WHATS_MY_ROLE RDB$ADMIN
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_HAS_ADMIN_ROLE <true>
MSG step-3
WHO_AM_I OZZY_OSBOURNE
WHATS_MY_ROLE RDB$ADMIN
NON_SYSDBA_USER_NAME BON_SCOTT
NON_SYSDBA_USER_NAME BON_SCOTT
NON_SYSDBA_HAS_ADMIN_ROLE <true>
Records affected: 2
/* Grant permissions for this database */
GRANT RDB$ADMIN TO BON_SCOTT GRANTED BY OZZY_OSBOURNE
GRANT RDB$ADMIN TO OZZY_OSBOURNE
GRANT CREATE DATABASE TO USER TMP$C4648
MSG step-4
WHO_AM_I OZZY_OSBOURNE
WHATS_MY_ROLE RDB$ADMIN
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_HAS_ADMIN_ROLE <true>
MSG step-4
WHO_AM_I OZZY_OSBOURNE
WHATS_MY_ROLE RDB$ADMIN
NON_SYSDBA_USER_NAME BON_SCOTT
NON_SYSDBA_USER_NAME BON_SCOTT
NON_SYSDBA_HAS_ADMIN_ROLE <false>
Records affected: 2
/* Grant permissions for this database */
GRANT RDB$ADMIN TO OZZY_OSBOURNE
GRANT CREATE DATABASE TO USER TMP$C4648
MSG step-5
WHO_AM_I OZZY_OSBOURNE
WHATS_MY_ROLE RDB$ADMIN
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_HAS_ADMIN_ROLE <true>
Records affected: 1
/* Grant permissions for this database */
GRANT RDB$ADMIN TO OZZY_OSBOURNE
GRANT CREATE DATABASE TO USER TMP$C4648
MSG step-6
WHO_AM_I OZZY_OSBOURNE
WHATS_MY_ROLE RDB$ADMIN
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_HAS_ADMIN_ROLE <false>
Records affected: 1
MSG step-7
WHO_AM_I OZZY_OSBOURNE
WHATS_MY_ROLE RDB$ADMIN
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_HAS_ADMIN_ROLE <false>
Records affected: 1
MSG step-8
WHO_AM_I OZZY_OSBOURNE
WHATS_MY_ROLE RDB$ADMIN
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_USER_NAME OZZY_OSBOURNE
NON_SYSDBA_HAS_ADMIN_ROLE <false>
Records affected: 1
/* Grant permissions for this database */
GRANT RDB$ADMIN TO OZZY_OSBOURNE
GRANT CREATE DATABASE TO USER TMP$C4648
MSG final
WHO_AM_I SYSDBA
WHATS_MY_ROLE NONE
NON_SYSDBA_USER_NAME <null>
NON_SYSDBA_HAS_ADMIN_ROLE <null>
Records affected: 1
"""
expected_stderr_1 = """

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4469
# title: Add field in SEC$USERS reflecting whether a user has RDB$ADMIN role in security database
# decription:
# decription:
# tracker_id: CORE-4469
# min_versions: ['3.0']
# versions: 3.0
@ -22,28 +22,28 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
set list on;
drop user boss1;
drop user boss2;
commit;
create user boss1 password '123' grant admin role;
commit;
select SEC$ADMIN is_admin_boss1 from sec$users where sec$user_name = upper('boss1');
select SEC$ADMIN is_admin_boss1 from sec$users where sec$user_name = upper('boss1');
create user boss2 password '456';
commit;
select SEC$ADMIN is_admin_boss2a from sec$users where sec$user_name = upper('boss2');
select SEC$ADMIN is_admin_boss2a from sec$users where sec$user_name = upper('boss2');
alter user boss2 grant admin role;
commit;
select SEC$ADMIN is_admin_boss2b from sec$users where sec$user_name = upper('boss2');
select SEC$ADMIN is_admin_boss2b from sec$users where sec$user_name = upper('boss2');
alter user boss2 revoke admin role;
commit;
select SEC$ADMIN is_admin_boss2c from sec$users where sec$user_name = upper('boss2');
select SEC$ADMIN is_admin_boss2c from sec$users where sec$user_name = upper('boss2');
drop user boss1;
drop user boss2;
commit;
@ -58,9 +58,17 @@ expected_stdout_1 = """
IS_ADMIN_BOSS2C <false>
"""
expected_stderr_1 = """
Statement failed, SQLSTATE = HY000
record not found for user: BOSS1
Statement failed, SQLSTATE = HY000
record not found for user: BOSS2
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4607
# title: Add support for having more than one UserManager in firebird.conf and use them from SQL
# decription:
# decription:
# Line "UserManager = Srp,..." has been added since ~MAR-2018 in firebird.conf before every fbt_run launch.
# Initial attempt to use Srp failed for following COREs tests: 2307, 3365, 4200, 4301, 4469 - and error
# was the same for all of them:
@ -11,13 +11,17 @@
# database" in Quick Start Guide
# ===
# (reply from dimitr, letter 31.05.2015 17:44).
#
#
# Checked on:
# fb30Cs, build 3.0.4.32972: OK, 0.844s.
# FB30SS, build 3.0.4.32988: OK, 1.203s.
# FB40CS, build 4.0.0.955: OK, 2.016s.
# FB40SS, build 4.0.0.1008: OK, 1.328s.
#
#
# [pcisar] 21.10.2021 - This test requires Legacy_UserManager to be listed
# in firebird.conf UserManager option, which is NOT by default.
# Otherwise it will FAIL with "Missing requested management plugin"
#
# tracker_id: CORE-4607
# min_versions: ['3.0.0']
# versions: 3.0
@ -40,7 +44,7 @@ test_script_1 = """
set count on;
create view v_test as
select sec$user_name, sec$plugin
from sec$users
from sec$users
where upper(sec$user_name) starting with upper('tmp$c4607')
order by 1,2
;
@ -73,6 +77,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
#act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4781
# title: Maximum string length (32765 bytes) is not validated
# decription:
# decription:
# tracker_id: CORE-4781
# min_versions: ['3.0']
# versions: 3.0
@ -21,7 +21,7 @@ init_script_1 = """"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
test_script_1 = """
recreate table test(bf blob);
recreate table test(bf blob);
commit;
-- At least since 31948 following **TWO** INSERT statements work OK.
@ -700,10 +700,10 @@ ldlkdw89dw89d2kssdjkcsuic3892343kbmvasjhcvsdyucg872348234ejwehsj#'
set blob all;
set list on;
select
bf is null bf_is_null,
octet_length(bf),
char_length(bf)
select
bf is null bf_is_null,
octet_length(bf),
char_length(bf)
from test;
"""
@ -720,6 +720,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4806
# title: Regression: generators can be seen/modified by unprivileged users
# decription:
# decription:
# We create sequence ('g') and three users and one role.
# First user ('big_brother') is granted to use generator directly.
# Second user ('bill_junior') is gratned to use generator via ROLE ('stockmgr').
@ -14,7 +14,7 @@
# Also, we do additional check for second user: try to connect WITHOUT specifying role
# and see/change sequence. Error must be in this case (SQLSTATE = 28000).
# Third user must NOT see neither value of generator nor to change it (SQLSTATE = 28000).
#
#
# :::::::::::::::::::::::::::::::::::::::: NB ::::::::::::::::::::::::::::::::::::
# 18.08.2020. FB 4.x has incompatible behaviour with all previous versions since build 4.0.0.2131 (06-aug-2020):
# statement 'CREATE SEQUENCE <G>' will create generator with current value LESS FOR 1 then it was before.
@ -22,13 +22,13 @@
# See also CORE-6084 and its fix: https://github.com/FirebirdSQL/firebird/commit/23dc0c6297825b2e9006f4d5a2c488702091033d
# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# This is considered as *expected* and is noted in doc/README.incompatibilities.3to4.txt
#
#
# Because of this, it was decided to filter out concrete values that are produced in 'SHOW SEQUENCE' command.
#
#
# Checked on:
# 4.0.0.2164
# 3.0.7.33356
#
#
# tracker_id: CORE-4806
# min_versions: ['3.0']
# versions: 3.0
@ -58,26 +58,26 @@ test_script_1 = """
end
^ set term ;^
commit;
create or alter user Maverick password '123';
create or alter user Big_Brother password '456';
create or alter user Bill_Junior password '789';
create role stockmgr;
commit;
revoke all on all from Maverick;
revoke all on all from Big_Brother;
revoke all on all from Bill_Junior;
--revoke all on all from stockmgr; -- COMMENTED TEMPLY, error "Revoke all on all from role <R> -- failed with "SQL role <R> does not exist in security database"", see core-4831
revoke all on all from public;
commit;
grant usage on sequence g to big_brother;
grant usage on sequence g to role stockmgr;
grant stockmgr to Bill_Junior;
commit;
show grants;
set list on;
connect '$(DSN)' user 'BIG_BROTHER' password '456';
@ -94,14 +94,14 @@ test_script_1 = """
connect '$(DSN)' user 'BILL_JUNIOR' password '789';
select current_user, current_role from rdb$database;
-- 'show sequ' should produce error:
-- Statement failed, SQLSTATE = 28000
-- no permission for USAGE access to GENERATOR G
-- There is no generator G in this database
-- (for user 'Bill_Junior' who connects w/o ROLE and thus has NO rights to see that sequence)
show sequ g;
-- 'select gen_id(...)' should produce error:
-- Statement failed, SQLSTATE = 28000
-- no permission for USAGE access to GENERATOR G
@ -142,6 +142,7 @@ expected_stdout_1 = """
GRANT STOCKMGR TO BILL_JUNIOR
GRANT USAGE ON SEQUENCE G TO USER BIG_BROTHER
GRANT USAGE ON SEQUENCE G TO ROLE STOCKMGR
GRANT CREATE DATABASE TO USER TMP$C4648
USER BIG_BROTHER
ROLE NONE
@ -166,7 +167,7 @@ expected_stderr_1 = """
Statement failed, SQLSTATE = 28000
no permission for USAGE access to GENERATOR G
Statement failed, SQLSTATE = 28000
no permission for USAGE access to GENERATOR G
There is no generator G in this database

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4826
# title: Make ISQL display character set when sqlda_display is on
# decription:
# decription:
# tracker_id: CORE-4826
# min_versions: ['3.0']
# versions: 3.0
@ -33,7 +33,7 @@ test_script_1 = """
tf2 time,
tf3 timestamp,
boo boolean,
tx1 char character set utf8,
tx1 char character set utf8,
tx2 varchar(10) character set iso8859_1,
tx3 nchar,
-- doesn`t compile: tx4 nvarchar(10),
@ -42,7 +42,7 @@ test_script_1 = """
tb2 blob sub_type 0
);
commit;
set sqlda_display on;
select * from test1;
commit;
@ -71,6 +71,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4831
# title: Revoke all on all from role <R> -- failed with "SQL role <R> does not exist in security database"
# decription:
# decription:
# tracker_id: CORE-4831
# min_versions: ['3.0']
# versions: 3.0
@ -34,13 +34,14 @@ test_script_1 = """
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stderr_1 = """
There is no privilege granted in this database
"""
expected_stdout_1 = """
/* Grant permissions for this database */
GRANT CREATE DATABASE TO USER TMP$C4648
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stderr = expected_stderr_1
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stderr == act_1.clean_stderr

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_4839
# title: SHOW GRANTS does not display info about exceptions which were granted to user
# decription:
# decription:
# tracker_id: CORE-4839
# min_versions: ['3.0']
# versions: 3.0
@ -28,7 +28,7 @@ test_script_1 = """
grant usage on exception exc_foo to tmp$c4839; -- this wasn`t shown before rev. 61822 (build 3.0.0.31881), 2015-06-14 11:35
grant usage on sequence gen_bar to tmp$c4839;
commit;
commit;
show grants;
commit;
drop user tmp$c4839;
@ -41,6 +41,7 @@ expected_stdout_1 = """
/* Grant permissions for this database */
GRANT USAGE ON SEQUENCE GEN_BAR TO USER TMP$C4839
GRANT USAGE ON EXCEPTION EXC_FOO TO USER TMP$C4839
GRANT CREATE DATABASE TO USER TMP$C4648
"""
@pytest.mark.version('>=3.0')

View File

@ -2,11 +2,11 @@
#
# id: bugs.core_4841
# title: Make message about missing password being always displayed as reply on attempt to issue CREATE new login without PASSWORD clause
# decription:
# Checked on
# decription:
# Checked on
# 4.0.0.2271 SS; 4.0.0.2265 SS; 4.0.0.2267 CS.
# 3.0.8.33392 SS; 3.0.8.33390 SC; 3.0.7.33388 CS.
#
#
# tracker_id: CORE-4841
# min_versions: ['3.0.7']
# versions: 3.0.7
@ -39,39 +39,31 @@ test_script_1 = """
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stderr_1 = """
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER U01 failed
-Password must be specified when creating user
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER U01 failed
-Password must be specified when creating user
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER U01 failed
-Password must be specified when creating user
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER U01 failed
-Password must be specified when creating user
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER U01 failed
-Password must be specified when creating user
Statement failed, SQLSTATE = HY000
Password must be specified when creating user
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER PASSWORD failed
-Password must be specified when creating user
"""
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER U01 failed
-Password must be specified when creating user
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER U01 failed
-Password must be specified when creating user
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER U01 failed
-Password must be specified when creating user
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER U01 failed
-Password must be specified when creating user
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER U01 failed
-Password must be specified when creating user
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE USER PASSWORD failed
-Password must be specified when creating user
"""
@pytest.mark.version('>=3.0.7')
def test_1(act_1: Action):

View File

@ -2,10 +2,14 @@
#
# id: bugs.core_5162
# title: SEC$ tables and tag/attributes
# decription:
# decription:
# FB30SS, build 3.0.4.32972: OK, 1.047s.
# FB40SS, build 4.0.0.977: OK, 1.266s.
#
#
# [pcisar] 21.10.2021 - This test requires Legacy_UserManager to be listed
# in firebird.conf UserManager option, which is NOT by default.
# Otherwise it will FAIL with "Missing requested management plugin"
#
# tracker_id: CORE-5162
# min_versions: ['3.0.0']
# versions: 3.0
@ -32,7 +36,7 @@ test_script_1 = """
execute statement 'drop user tmp$c5162 using plugin Legacy_UserManager' with autonomous transaction;
when any do begin end
end
begin
execute statement 'drop user tmp$c5162 using plugin Srp' with autonomous transaction;
when any do begin end

View File

@ -2,22 +2,22 @@
#
# id: bugs.core_5225
# title: Authentication end with first plugin that has the user but auth fails; should continue with next plugin
# decription:
# decription:
# We create two users with the same name, 1st using plugin Srp, 2nd - via Legacy.
# Then we try to establish subsequent attachments via ES/EDS for each of them.
# No error should occur.
#
#
# Confirmed exception on 3.0.0 for plugin that was specified as SECOND in firebird.conf, got:
# Statement failed, SQLSTATE = 42000
# Execute statement error at attach :
# 335544472 : Your user name and password are not defined <...>
#
#
# Works fine on:
# fb30Cs, build 3.0.4.32947: OK, 2.907s.
# FB30SS, build 3.0.4.32963: OK, 1.140s.
# FB40CS, build 4.0.0.955: OK, 3.531s.
# FB40SS, build 4.0.0.967: OK, 1.312s.
#
#
# tracker_id: CORE-5225
# min_versions: ['3.0.1']
# versions: 3.0.1
@ -41,7 +41,7 @@ test_script_1 = """
create or alter user tmp$c5225 password 'srp' using plugin Srp;
create or alter user tmp$c5225 password 'leg' using plugin Legacy_UserManager;
commit;
set term ^;
execute block returns(whoami_leg varchar(31)) as
begin

View File

@ -2,11 +2,11 @@
#
# id: bugs.core_5246
# title: String truncation error while selecting from MON$ tables if some user-defined context variable exceeds 255 bytes in length
# decription:
# More description see here:
# decription:
# More description see here:
# https://github.com/FirebirdSQL/firebird/commit/373c4599d3f2be06ea9d239a25e18248c8d38a64
# See also: CORE-6248.
#
#
# tracker_id: CORE-5246
# min_versions: ['3.0.1']
# versions: 3.0.1
@ -55,6 +55,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0.1')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,33 +2,33 @@
#
# id: bugs.core_5302
# title: Performance regression when bulk inserting into table with indices
# decription:
# decription:
# Test uses TWO tables, one w/o indices and another with indexes.
# We evaluate RATIO between performance rather than absolute duration values.
# This ratio then is compared with THRESHOLD which was choosen after dozen runs
# of test on FB 3.0 and 4.0.
#
#
# _BEFORE_ this ticket was fixed ratio was following:
#
#
# Ratio for 4.0.0.258: ~32...34 -- poor
# Ratio for 3.0.1.32566: ~23...24 -- poor
#
#
# _AFTER_ ticket was fixed ratio is:
#
#
# Ratio for 4.0.0.313: ~11...13 -- OK
# Ratio for 3.0.1.32568: ~10...11 -- OK
#
#
# Fix for 4.0 was 07-jul-2016, see here:
# https://github.com/FirebirdSQL/firebird/commit/a75e0af175ea6e803101b5fd62ec91cdf039b951
# Fix for 3.0 was 27-jul-2016, see here:
# https://github.com/FirebirdSQL/firebird/commit/96a24228b61003e72c68596faf3c4c4ed0b95ea1
#
#
# All measures were done on regular PC, OS = Windows XP, CPU 3.0 Ghz, RAM 2 Gb, HDD IDE.
# 05.01.2020: increased threshold from 15 to 20 (Win 2008 Server R2, ram 8gb)
# Checked on:
# 4.0.0.1714 SS: 5.922s; 4.0.0.1714 SC: 7.891s; 4.0.0.1714 CS: 9.891s.
# 3.0.5.33221 SS: 4.735s; 3.0.5.33221 SC: 5.718s; 3.0.5.33221 CS: 7.126s.
#
#
# 13.01.2020: checked again (Win 8.1 Pro, ram 12 gb):
# 4.0.0.2325 SS: 5.806s.
# 4.0.0.2324 SC: 5.812s.
@ -36,7 +36,9 @@
# 3.0.8.33401 SS: 5.366s.
# 3.0.8.33401 SC: 4.823s.
# 3.0.8.33401 CS: 6.089s.
#
#
# [pcisar] 21.10.2021 - This test is sensitive to user test environment, and may FAIL on slow drives/machines !!!
#
# tracker_id: CORE-5302
# min_versions: ['3.0.0']
# versions: 3.0
@ -67,7 +69,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
set list on;
set term ^;
execute block returns(msg varchar(100)) as
execute block returns(msg varchar(100)) as
declare n int = 50000;
declare m int;
declare t0 timestamp;
@ -90,9 +92,9 @@ test_script_1 = """
cur_ratio = 1.0000 * datediff(millisecond from t1 to t2) / datediff(millisecond from t0 to t1);
msg = iif( cur_ratio < max_ratio,
'OK, ratio is acceptable',
'POOR: ratio = ' || cur_ratio || ' - exceeds threshold = ' || max_ratio
msg = iif( cur_ratio < max_ratio,
'OK, ratio is acceptable',
'POOR: ratio = ' || cur_ratio || ' - exceeds threshold = ' || max_ratio
);
suspend;
@ -110,6 +112,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,7 +2,7 @@
#
# id: bugs.core_5313
# title: Data type unknown error with LIST
# decription:
# decription:
# tracker_id: CORE-5313
# min_versions: ['3.0.1']
# versions: 3.0.1, 4.0
@ -11,7 +11,7 @@
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 3.0.1
# version: 3.0.7
# resources: None
substitutions_1 = []
@ -21,51 +21,14 @@ init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
set planonly;
set sqlda_display on;
set planonly;
set sqlda_display on;
select list(trim(rdb$relation_name), ?) from rdb$relations;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
INPUT message field count: 1
01: sqltype: 452 TEXT scale: 0 subtype: 0 len: 3 charset: 3 UNICODE_FSS
: name: alias:
: table: owner:
PLAN (RDB$RELATIONS NATURAL)
OUTPUT message field count: 1
01: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 3 UNICODE_FSS
: name: LIST alias: LIST
: table: owner:
"""
@pytest.mark.version('>=3.0.1,<4.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
# version: 4.0
# resources: None
substitutions_2 = []
init_script_2 = """"""
db_2 = db_factory(sql_dialect=3, init=init_script_2)
test_script_2 = """
set planonly;
set sqlda_display on;
select list(trim(rdb$relation_name), ?) from rdb$relations;
"""
act_2 = isql_act('db_2', test_script_2, substitutions=substitutions_2)
expected_stdout_2 = """
INPUT message field count: 1
01: sqltype: 452 TEXT scale: 0 subtype: 0 len: 4 charset: 4 UTF8
: name: alias:
@ -79,9 +42,9 @@ expected_stdout_2 = """
: table: owner:
"""
@pytest.mark.version('>=4.0')
def test_2(act_2: Action):
act_2.expected_stdout = expected_stdout_2
act_2.execute()
assert act_2.clean_expected_stdout == act_2.clean_stdout
@pytest.mark.version('>=3.0.7')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,10 +2,10 @@
#
# id: bugs.core_5341
# title: User collate doesn't work with blobs
# decription:
# decription:
# Reproduced bug on 3.0.1.32594.
# All fine on WI-V3.0.1.32596, WI-T4.0.0.366.
#
#
# tracker_id: CORE-5341
# min_versions: ['3.0.1']
# versions: 3.0.1
@ -45,7 +45,7 @@ test_script_1 = """
union all
select 'UPDATE' from rdb$database
)
select * from a
select * from a
where blob_id collate PXW_CYRL_CI_AI like '%update%';
"""
@ -59,6 +59,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=3.0.1')
def test_1(act_1: Action):
act_1.charset = 'WIN1251'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -2,11 +2,11 @@
#
# id: bugs.core_6340
# title: Alternate quoting does not work on some particular cases
# decription:
# decription:
# Checked on build 4.0.0.2073 with timestamp 24.06.2020 13:40 (intermediate).
# NOTE: test tries several cases + checks that string with maximum limit of length (65533) can be properly parsed.
# 04.07.2020: changed min_version to 3.0.6 - checked on 3.0.6.33332.
#
#
# tracker_id: CORE-6340
# min_versions: ['3.0.6']
# versions: 3.0.6
@ -30,8 +30,8 @@ test_script_1 = """
-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set list on;
select 'point-0.01' as msg, q'{{}' as result from rdb$database;
select 'point-0.02' as msg, q'{}}' as result from rdb$database;
select 'point-0.01' as msg, q'{{}' as result from rdb$database;
select 'point-0.02' as msg, q'{}}' as result from rdb$database;
select 'point-0.03' as msg, q'!'!' as result from rdb$database;
@ -45,7 +45,7 @@ select 'point-1.06' as msg, q'!
!' as result from rdb$database;
select 'point-1.07' as msg, q'!!' as result from rdb$database;
select 'point-1.08' as msg, q'!!!' as result from rdb$database;
select 'point-1.09' as msg, q'!
@ -185,7 +185,7 @@ select 'point-5.06' as msg, q'q
'
q' as result from rdb$database; -- expected: ' followed by [CR/]LF
select 'point-5.07' as msg, q'qq' as result from rdb$database; -- expected: empty string
select 'point-5.07' as msg, q'qq' as result from rdb$database; -- expected: empty string
select 'point-5.08' as msg, q'qqq' as result from rdb$database; -- expected: q
@ -224,7 +224,7 @@ RESULT '
MSG point-1.03
RESULT '
RESULT '
@ -239,14 +239,14 @@ RESULT '''
MSG point-1.06
RESULT
RESULT
'
MSG point-1.07
RESULT
RESULT
@ -256,7 +256,7 @@ RESULT !
MSG point-1.09
RESULT
RESULT
!
@ -293,7 +293,7 @@ RESULT ''''''''''''''''''''''''''''''''''''''''''''''''
MSG point-2.01
RESULTS '''
RESULTS '''
@ -338,7 +338,7 @@ RESULT '
MSG point-3.03
RESULT '
RESULT '
@ -353,14 +353,14 @@ RESULT '''
MSG point-3.06
RESULT
RESULT
'
MSG point-3.07
RESULT
RESULT
@ -370,7 +370,7 @@ RESULT !
MSG point-3.09
RESULT
RESULT
!
@ -403,14 +403,14 @@ RESULT !
MSG point-3.15
RESULT
RESULT
!
'
MSG point-3.16
RESULT
RESULT
'!
''
'!
@ -429,7 +429,7 @@ RESULT '
MSG point-4.03
RESULT '
RESULT '
@ -444,14 +444,14 @@ RESULT '''
MSG point-4.06
RESULT
RESULT
'
MSG point-4.07
RESULT
RESULT
@ -461,7 +461,7 @@ RESULT |
MSG point-4.09
RESULT
RESULT
|
@ -493,14 +493,14 @@ RESULT ||
MSG point-4.15
RESULT
RESULT
|
'
MSG point-4.16
RESULT
RESULT
'|
''
'|
@ -559,14 +559,14 @@ RESULT '''
MSG point-5.06
RESULT
RESULT
'
MSG point-5.07
RESULT
RESULT
@ -586,6 +586,7 @@ RESULT 'q '
@pytest.mark.version('>=3.0.6')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -3,7 +3,7 @@
# id: functional.intfunc.misc.gen_uuid_01
# title: test for GEN_UUID()
# decription: Returns a universal unique number.
# tracker_id:
# tracker_id:
# min_versions: []
# versions: 3.0
# qmid: functional.intfunc.misc.gen_uuid_01
@ -61,6 +61,7 @@ expected_stdout_1 = """ COUNT
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout

View File

@ -3,7 +3,7 @@
# id: functional.tabloid.arithmetic_numexpr_eval_dialect_1
# title: Check result of integer division on dialect 1.
# decription: Was fixed in 2.1, see: sql.ru/forum/actualutils.aspx?action=gotomsg&tid=708324&msg=7865013
# tracker_id:
# tracker_id:
# min_versions: ['2.5.0']
# versions: 2.5
# qmid: None
@ -27,7 +27,7 @@ test_script_1 = """
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
D -3
D -3.000000000000000
"""
@pytest.mark.version('>=2.5')

View File

@ -2,8 +2,8 @@
#
# id: functional.tabloid.eqc_200762
# title: Check results of CONTAINING when search pattern can span on one or several blob segments
# decription:
# tracker_id:
# decription:
# tracker_id:
# min_versions: ['2.5.0']
# versions: 2.5
# qmid: None
@ -30,74 +30,74 @@ test_script_1 = """
^
set term ;^
commit;
create sequence g;
recreate table test (
id int primary key,
pattern varchar(32765),
memotext blob sub_type 1 segment size 1024 character set none
);
set term ^;
execute block returns(id int, ptrn_len int, blob_len int, ptrn_pos int) as
declare v_pattern varchar(32765);
declare v_db_page smallint;
declare v_id int;
begin
select mon$page_size from mon$database into v_db_page;
delete from test;
v_pattern = 'qwertyuioplkjhgfdsa1234567890zxcvbnm';
-- short pattern (len < 50 bytes), start on 1st segment and spans to 2nd:
insert into test(id, pattern, memotext)
insert into test(id, pattern, memotext)
values( gen_id(g,1), :v_pattern, rpad( '', 1000, uuid_to_char(gen_uuid()) ) || :v_pattern );
-- middle length pattern (len > 1024 and <= db_page_size)
insert into test(id, pattern)
insert into test(id, pattern)
values(gen_id(g,1), rpad( '', 2.0/3 * :v_db_page, uuid_to_char(gen_uuid()) ) )
returning id, pattern into v_id, v_pattern;
update test set memotext = rpad( '', 1001, uuid_to_char(gen_uuid()) ) || :v_pattern
where id = :v_id;
insert into test(id, pattern) values(gen_id(g,1), rpad( '', 3.0/4 * :v_db_page, uuid_to_char(gen_uuid()) ) )
returning id, pattern into v_id, v_pattern;
update test set memotext = rpad( '', 1002, uuid_to_char(gen_uuid()) ) || :v_pattern
where id = :v_id;
insert into test(id, pattern) values(gen_id(g,1), rpad( '', :v_db_page, uuid_to_char(gen_uuid()) ) )
returning id, pattern into v_id, v_pattern;
update test set memotext = rpad( '', 1003, uuid_to_char(gen_uuid()) ) || :v_pattern
where id = :v_id;
-- large length pattern ( > db_page_size):
insert into test(id, pattern) values(gen_id(g,1), rpad( '', 5.0/4 * :v_db_page, uuid_to_char(gen_uuid()) ) )
returning id, pattern into v_id, v_pattern;
update test set memotext = rpad( '', 1004, uuid_to_char(gen_uuid()) ) || :v_pattern
where id = :v_id;
insert into test(id, pattern) values(gen_id(g,1), rpad( '', 4.0/3 * :v_db_page, uuid_to_char(gen_uuid()) ) )
returning id, pattern into v_id, v_pattern;
update test set memotext = rpad( '', 1005, uuid_to_char(gen_uuid()) ) || :v_pattern
where id = :v_id;
insert into test(id, pattern) values(gen_id(g,1), rpad( '', 31724, uuid_to_char(gen_uuid()) ) )
returning id, pattern into v_id, v_pattern;
update test set memotext = rpad( '', 1006, uuid_to_char(gen_uuid()) ) || :v_pattern
where id = :v_id;
for
select id, char_length(pattern), char_length(memotext), position(pattern in memotext)
from test
where memotext containing pattern
order by id
into id, ptrn_len, blob_len, ptrn_pos
do
do
suspend;
end
^
@ -112,32 +112,32 @@ expected_stdout_1 = """
PTRN_LEN 36
BLOB_LEN 1036
PTRN_POS 1001
ID 2
PTRN_LEN 4915
BLOB_LEN 5916
PTRN_POS 1002
ID 3
PTRN_LEN 5734
BLOB_LEN 6736
PTRN_POS 1003
ID 4
PTRN_LEN 8192
BLOB_LEN 9195
PTRN_POS 1004
ID 5
PTRN_LEN 9830
BLOB_LEN 10834
PTRN_POS 1005
ID 6
PTRN_LEN 10650
BLOB_LEN 11655
PTRN_POS 1006
ID 7
PTRN_LEN 31724
BLOB_LEN 32730
@ -146,6 +146,7 @@ expected_stdout_1 = """
@pytest.mark.version('>=2.5')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout