6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-02-02 02:40:42 +01:00

New metadata + cleanup

This commit is contained in:
Pavel Císař 2022-01-19 17:54:56 +01:00
parent b347f1d1c4
commit 8e1956d242
73 changed files with 3671 additions and 4571 deletions

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1000
# title: Incorrect results when left join on subquery with constant column
# decription:
# tracker_id: CORE-1000
# min_versions: []
# versions: 2.5.0
# qmid: None
"""
ID: issue-1411
ISSUE: 1411
TITLE: Incorrect results when left join on subquery with constant column
DESCRIPTION:
JIRA: CORE-1000
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5.0
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE A (
init_script = """CREATE TABLE A (
ID INTEGER
);
@ -34,17 +29,17 @@ insert into B (id) values (2);
commit;
"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """select a.id, b.id, bexists
test_script = """select a.id, b.id, bexists
from a
left join (select id, 1 bexists from b) b on (a.id=b.id);
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
ID ID BEXISTS
============ ============ ============
1 1 1
@ -53,9 +48,9 @@ expected_stdout_1 = """
"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,32 +1,27 @@
#coding:utf-8
#
# id: bugs.core_1002
# title: bad handling of /*/ comments in ISQL
# decription:
# tracker_id: CORE-1002
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1002
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """/*/ select * from rdb$database; /*/
"""
ID: issue-1413
ISSUE: 1413
TITLE: Bad handling of /*/ comments in ISQL
DESCRIPTION:
Original title is: "set echo on" didn't work after /*////////////*/ comments in input file
JIRA: CORE-1002
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
import pytest
from firebird.qa import *
db = db_factory()
test_script = """/*/ select * from rdb$database; /*/
"""
act = isql_act('db', test_script)
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.execute()
def test_1(act: Action):
try:
act.execute()
except ExecutionError as e:
pytest.fail("Test script execution failed", pytrace=False)

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1004
# title: context already in use (BLR error)
# decription:
# tracker_id: CORE-1004
# min_versions: []
# versions: 2.0.1
# qmid: bugs.core_1004
"""
ID: issue-1415
ISSUE: 1415
TITLE: Context already in use (BLR error)
DESCRIPTION:
JIRA: CORE-1004
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.1
# resources: None
substitutions_1 = []
init_script_1 = """SET TERM ^;
init_script = """SET TERM ^;
CREATE OR ALTER PROCEDURE GET_REL_NAME (REL_ID INT) RETURNS (REL_NAME VARCHAR(32))
AS
@ -35,9 +30,9 @@ COMMIT;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """SET TERM ^;
test_script = """SET TERM ^;
CREATE OR ALTER PROCEDURE BUG
AS
@ -64,10 +59,11 @@ SET TERM ;^
COMMIT;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@pytest.mark.version('>=2.0.1')
def test_1(act_1: Action):
act_1.execute()
act = isql_act('db', test_script)
@pytest.mark.version('>=3')
def test_1(act: Action):
try:
act.execute()
except ExecutionError as e:
pytest.fail("Test script execution failed", pytrace=False)

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1005
# title: DISTINCT vs NULLS LAST clause: wrong order of NULLs
# decription:
# tracker_id: CORE-1005
# min_versions: []
# versions: 2.0.1
# qmid: bugs.core_1005
"""
ID: issue-1416
ISSUE: 1416
TITLE: DISTINCT vs NULLS LAST clause: wrong order of NULLs
DESCRIPTION:
JIRA: CORE-1005
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.1
# resources: None
substitutions_1 = []
init_script_1 = """create table T (A int, B int) ;
init_script = """create table T (A int, B int) ;
commit ;
insert into T values (1,1);
@ -29,16 +24,16 @@ insert into T values (4,4);
commit ;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """select distinct A, B from T order by A nulls last, B nulls last ;
test_script = """select distinct A, B from T order by A nulls last, B nulls last ;
select distinct A, B from T order by A nulls last ;
select distinct A, B from T order by B nulls last ;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """A B
expected_stdout = """A B
============ ============
1 1
2 2
@ -64,9 +59,9 @@ A B
"""
@pytest.mark.version('>=2.0.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,26 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1006
# title: AV at rollback and \\ or garbage collection if updated table have expression index with SELECT in it
# decription: This test takes the server down.
# tracker_id: CORE-1006
# min_versions: []
# versions: 2.0.1
# qmid: bugs.core_1006
"""
ID: issue-1417
ISSUE: 1417
TITLE: AV at rollback and \\ or garbage collection if updated table have expression index with SELECT in it
DESCRIPTION:
JIRA: CORE-1006
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.1
# resources: None
db = db_factory(from_backup='core1006.fbk')
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(from_backup='core1006.fbk', init=init_script_1)
test_script_1 = """
test_script = """
set term ^;
execute block
as
@ -44,10 +37,11 @@ test_script_1 = """
rollback;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@pytest.mark.version('>=2.0.1')
def test_1(act_1: Action):
act_1.execute()
act = isql_act('db', test_script)
@pytest.mark.version('>=3')
def test_1(act: Action):
try:
act.execute()
except ExecutionError as e:
pytest.fail("Test script execution failed", pytrace=False)

View File

@ -1,42 +1,35 @@
#coding:utf-8
#
# id: bugs.core_1009
# title: Restoring RDB$BASE_FIELD for expression
# decription: RDB$BASE_FIELD for expression have to be NULL
# tracker_id: CORE-1009
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1009
"""
ID: issue-1419
ISSUE: 1419
TITLE: Restoring RDB$BASE_FIELD for expression
DESCRIPTION: RDB$BASE_FIELD for expression have to be NULL
JIRA: CORE-1009
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
db = db_factory(from_backup='core1009.fbk')
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(from_backup='core1009.fbk', init=init_script_1)
test_script_1 = """
test_script = """
set list on;
select rdb$field_name, rdb$base_field from rdb$relation_fields where rdb$relation_name = 'TEST_VIEW';
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
RDB$FIELD_NAME ID
RDB$BASE_FIELD ID
RDB$FIELD_NAME EXPR
RDB$BASE_FIELD <null>
"""
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,30 +1,26 @@
#coding:utf-8
#
# id: bugs.core_1010
# title: Local buffer overrun in DYN_error() that takes down the server
# decription: We have a local buffer overrun in DYN_error(), while copying tdbb_status_vector to local_status. It seems to be the first time (DYN errors + stack trace facility) when 20 status words are not enough to store the complete error info.
# tracker_id: CORE-1010
# min_versions: []
# versions: 3.0
# qmid: bugs.core_1010-21
"""
ID: issue-1420
ISSUE: 1420
TITLE: Local buffer overrun in DYN_error() that takes down the server
DESCRIPTION:
We have a local buffer overrun in DYN_error(), while copying tdbb_status_vector to
local_status. It seems to be the first time (DYN errors + stack trace facility) when 20
status words are not enough to store the complete error info.
JIRA: CORE-1010
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
db = db_factory()
substitutions_1 = [('line:.*', ''), ('col:.*', '')]
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
-- Removed old code: all attempts to create triggers on SYSTEM tables now are prohibited, even for SYSDBA.
create exception ex_test '!!!';
commit;
set term ^ ;
create or alter trigger rdb$procedures_biu for rdb$procedures
active after update or delete position 0
@ -34,7 +30,7 @@ test_script_1 = """
end
^
commit^
create or alter procedure proctest returns (result integer) as
begin
result = 0;
@ -44,9 +40,9 @@ test_script_1 = """
commit;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script, substitutions=[('line:.*', ''), ('col:.*', '')])
expected_stderr_1 = """
expected_stderr = """
Statement failed, SQLSTATE = 28000
unsuccessful metadata update
-CREATE OR ALTER TRIGGER RDB$PROCEDURES_BIU failed
@ -54,8 +50,8 @@ expected_stderr_1 = """
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_stderr == act_1.clean_expected_stderr
def test_1(act: Action):
act.expected_stderr = expected_stderr
act.execute()
assert act.clean_stderr == act.clean_expected_stderr

View File

@ -1,24 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1018
# title: Provide mechanism to get engine version without needing to call API function
# decription:
# tracker_id: CORE-1018
# min_versions: []
# versions: 3.0, 4.0, 5.0
# qmid: bugs.core_1018-211
"""
ID: issue-632
ISSUE: 632
TITLE: Provide mechanism to get engine version without needing to call API function
DESCRIPTION:
JIRA: CORE-1018
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory()
test_script_1 = """
set list on;
@ -32,7 +27,7 @@ test_script_1 = """
)t;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act_1 = isql_act('db', test_script_1)
expected_stdout_1 = """
VERSION 3.0
@ -45,13 +40,6 @@ def test_1(act_1: Action):
assert act_1.clean_stdout == act_1.clean_expected_stdout
# version: 4.0
# resources: None
substitutions_2 = [('4\\.\\d+', '4\\.')]
init_script_2 = """"""
db_2 = db_factory(sql_dialect=3, init=init_script_2)
test_script_2 = """
set list on;
@ -65,7 +53,8 @@ test_script_2 = """
)t;
"""
act_2 = isql_act('db_2', test_script_2, substitutions=substitutions_2)
act_2 = isql_act('db', test_script_2, substitutions=[('4\\.\\d+', '4\\.')]
)
expected_stdout_2 = """
VERSION 4.0
@ -78,13 +67,6 @@ def test_2(act_2: Action):
assert act_2.clean_stdout == act_2.clean_expected_stdout
# version: 5.0
# resources: None
substitutions_3 = [('5\\.\\d+', '5\\.')]
init_script_3 = """"""
db_3 = db_factory(sql_dialect=3, init=init_script_3)
test_script_3 = """
set list on;
@ -98,7 +80,7 @@ test_script_3 = """
)t;
"""
act_3 = isql_act('db_3', test_script_3, substitutions=substitutions_3)
act_3 = isql_act('db', test_script_3, substitutions=[('5\\.\\d+', '5\\.')])
expected_stdout_3 = """
VERSION 5.0

View File

@ -1,46 +1,39 @@
#coding:utf-8
#
# id: bugs.core_1019
# title: Make information available regading ODS Version and Dialect via SQL
# decription:
# tracker_id: CORE-1019
# min_versions: []
# versions: 2.5.0
# qmid: bugs.core_1019-250
"""
ID: issue-1430
ISSUE: 1430
TITLE: Make information available regading ODS Version and Dialect via SQL
DESCRIPTION:
JIRA: CORE-1019
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5.0
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
set list on;
-- Refactored 05-may-2018, to be universal for all possible ODS numbers:
select
select
iif( mon$ods_major similar to '[[:digit:]]{1,2}', 'YES', 'NO!') as "ods_major_looks_ok ?"
, iif( mon$ods_minor similar to '[[:digit:]]{1,2}', 'YES', 'NO!') as "ods_minor_looks_ok ?"
, iif( mon$sql_dialect similar to '[[:digit:]]{1}', 'YES', 'NO!') as "sql_dialect_looks_ok ?"
from mon$database;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
ods_major_looks_ok ? YES
ods_minor_looks_ok ? YES
sql_dialect_looks_ok ? YES
"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,31 +1,26 @@
#coding:utf-8
#
# id: bugs.core_1025
# title: Server crashes at runtime when an explicit MERGE plan is specified over a few JOIN ones
# decription:
# tracker_id: CORE-1025
# min_versions: []
# versions: 2.0.1
# qmid: bugs.core_1025
"""
ID: issue-1439
ISSUE: 1439
TITLE: Server crashes at runtime when an explicit MERGE plan is specified over a few JOIN ones
DESCRIPTION:
JIRA: CORE-1025
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.1
# resources: None
substitutions_1 = []
init_script_1 = """recreate table t (id int not null);
init_script = """recreate table t (id int not null);
alter table t add constraint pk primary key (id);
insert into t values (1);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """select *
test_script = """select *
from t t1, t t2, t t3, t t4
where t1.id = t2.id
and t2.id = t3.id
@ -34,17 +29,17 @@ PLAN MERGE (JOIN (T1 NATURAL, T2 INDEX (PK)), JOIN(T3 NATURAL, T4 INDEX (PK)));
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """ID ID ID ID
expected_stdout = """ID ID ID ID
============ ============ ============ ============
1 1 1 1
"""
@pytest.mark.version('>=2.0.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,79 +1,67 @@
#coding:utf-8
#
# id: bugs.core_1026_utf8
# title: Estonian collation in UTF8 charset
# decription:
# Original ticker subj: Estonian collations for WIN1252 charset
#
# http://www.eki.ee/itstandard/2000/FDCC.shtml.en
# Estonian sort order changes the default positions for one base character (<z>), š and ž ('s' and 'z' with caron)
# and four accented vowels in the Estonian alphabet:
# * <z> and all it's modifications are ordered after <s>;
# * 'š' and 'ž' are separate letters and follow the unaccented <s> and <z> respectively.
# * all four Estonian vowels with diacritics - 'ä', 'ö', 'õ' and 'ü' - are also sorted as separate
# letters after 'w';
# * 'w' is generally sorted as a separate letter except of Estonian personnal names.
# Thus the Estonian alphabet ends with:
# ####################################
# ... r s š z ž t u v w õ ä ö ü x y
# ####################################
#
# NOTE-1:
# collation = WIN1252_UNICODE (defined for charset WIN1252 in %FB_HOME%\\intl
# bintl.conf) sorts
# estonian letters NOT as expected: a,A,ä,Ä,b...,o,O,ö,Ö,õ,Õ,...,s,S,š,Š,t,T,u,U,ü,Ü,...,z,Z,ž,Ž
#
# NOTE-2:
# collation WIN1257_EE (defined for charset WIN1257) sorts estonian letters properly but this collation
# is not what author asked about ("CP 1257 (Baltic) is suggested as second when 1252 is not available.")
# Because of this, UTF8 collation for LOCALE=et_EE is tested here.
#
# NOTE-3:
# lowercase letters are sorted BEFORE uppercase ones ('a' < 'A') when we use most of collations,
# including utf8 'LOCALE=et_EE'. This is defined by current ICU implementation.
# Current syntax of CREATE COLLATION statement do not allow to change priority of uppercase/lowercase
# letters which denote the same character when they are sorted.
#
# Result of sorting such letters will be opposite to "ascii-style" where uppercase letters ('A')
# are always considered as less then lowercase ones ('a').
#
# Quote from https://unicode.org/reports/tr10/#Case_Comparisons
# =====
# "In some languages, it is common to sort lowercase before uppercase; in other languages this is reversed.
# Often this is more dependent on the individual concerned, and is not standard across a single language.
# It is strongly recommended that implementations provide parameterization that allows uppercase to be
# sorted before lowercase, and provides information as to the standard (if any) for particular countries".
# ======
# See also:
# http://userguide.icu-project.org/collation/concepts
#
# Checked on 4.0.0.2214
#
# tracker_id: CORE-1026
# min_versions: ['4.0']
# versions: 4.0
# qmid: None
"""
ID: issue-1440
ISSUE: 1440
TITLE: Estonian collation in UTF8 charset
DESCRIPTION:
Original ticker subj: Estonian collations for WIN1252 charset
http://www.eki.ee/itstandard/2000/FDCC.shtml.en
Estonian sort order changes the default positions for one base character (<z>), š and ž ('s' and 'z' with caron)
and four accented vowels in the Estonian alphabet:
* <z> and all it's modifications are ordered after <s>;
* 'š' and 'ž' are separate letters and follow the unaccented <s> and <z> respectively.
* all four Estonian vowels with diacritics - 'ä', 'ö', 'õ' and 'ü' - are also sorted as separate letters after 'w';
* 'w' is generally sorted as a separate letter except of Estonian personnal names.
Thus the Estonian alphabet ends with:
####################################
... r s š z ž t u v w õ ä ö ü x y
####################################
NOTES:
[1]
collation = WIN1252_UNICODE (defined for charset WIN1252 in %FB_HOME%\\intl\\fbintl.conf) sorts
estonian letters NOT as expected: a,A,ä,Ä,b...,o,O,ö,Ö,õ,Õ,...,s,S,š,Š,t,T,u,U,ü,Ü,...,z,Z,ž,Ž
[2]
collation WIN1257_EE (defined for charset WIN1257) sorts estonian letters properly but this collation
is not what author asked about ("CP 1257 (Baltic) is suggested as second when 1252 is not available.")
Because of this, UTF8 collation for LOCALE=et_EE is tested here.
[3]
lowercase letters are sorted BEFORE uppercase ones ('a' < 'A') when we use most of collations,
including utf8 'LOCALE=et_EE'. This is defined by current ICU implementation.
Current syntax of CREATE COLLATION statement do not allow to change priority of uppercase/lowercase
letters which denote the same character when they are sorted.
Result of sorting such letters will be opposite to "ascii-style" where uppercase letters ('A')
are always considered as less then lowercase ones ('a').
Quote from https://unicode.org/reports/tr10/#Case_Comparisons
=====
"In some languages, it is common to sort lowercase before uppercase; in other languages this is reversed.
Often this is more dependent on the individual concerned, and is not standard across a single language.
It is strongly recommended that implementations provide parameterization that allows uppercase to be
sorted before lowercase, and provides information as to the standard (if any) for particular countries".
======
See also:
http://userguide.icu-project.org/collation/concepts
JIRA: CORE-1026
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 4.0
# resources: None
db = db_factory(charset='UTF8')
substitutions_1 = [('[ \t]+', ' ')]
init_script_1 = """"""
db_1 = db_factory(charset='UTF8', sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
set bail on;
-- NB: 'et' in 'LOCALE=...' must be specified in lowercase!
create collation estonian_coll_cs_as for utf8 from unicode 'LOCALE=et_EE';
create collation estonian_coll_ci_ai for utf8 from unicode case insensitive accent insensitive 'LOCALE=et_EE';
create table test(
create table test(
id smallint generated by default as identity
,s varchar(1) character set utf8 collate estonian_coll_cs_as
);
@ -83,42 +71,42 @@ test_script_1 = """
-- Fill records according to SORT order that is declared by Estonian Standardization Board
-- http://www.eki.ee/itstandard/2000/FDCC.shtml.en
insert into test(s) values( 'a' );
insert into test(s) values( 'a' );
insert into test(s) values( 'A' );
insert into test(s) values( 'b' );
insert into test(s) values( 'B' );
insert into test(s) values( 'c' );
insert into test(s) values( 'C' );
insert into test(s) values( 'd' );
insert into test(s) values( 'D' );
insert into test(s) values( 'e' );
insert into test(s) values( 'E' );
insert into test(s) values( 'f' );
insert into test(s) values( 'F' );
insert into test(s) values( 'g' );
insert into test(s) values( 'G' );
insert into test(s) values( 'b' );
insert into test(s) values( 'B' );
insert into test(s) values( 'c' );
insert into test(s) values( 'C' );
insert into test(s) values( 'd' );
insert into test(s) values( 'D' );
insert into test(s) values( 'e' );
insert into test(s) values( 'E' );
insert into test(s) values( 'f' );
insert into test(s) values( 'F' );
insert into test(s) values( 'g' );
insert into test(s) values( 'G' );
insert into test(s) values( 'h' );
insert into test(s) values( 'H' );
insert into test(s) values( 'i' );
insert into test(s) values( 'I' );
insert into test(s) values( 'j' );
insert into test(s) values( 'J' );
insert into test(s) values( 'k' );
insert into test(s) values( 'K' );
insert into test(s) values( 'l' );
insert into test(s) values( 'L' );
insert into test(s) values( 'm' );
insert into test(s) values( 'M' );
insert into test(s) values( 'n' );
insert into test(s) values( 'N' );
insert into test(s) values( 'o' );
insert into test(s) values( 'O' );
insert into test(s) values( 'H' );
insert into test(s) values( 'i' );
insert into test(s) values( 'I' );
insert into test(s) values( 'j' );
insert into test(s) values( 'J' );
insert into test(s) values( 'k' );
insert into test(s) values( 'K' );
insert into test(s) values( 'l' );
insert into test(s) values( 'L' );
insert into test(s) values( 'm' );
insert into test(s) values( 'M' );
insert into test(s) values( 'n' );
insert into test(s) values( 'N' );
insert into test(s) values( 'o' );
insert into test(s) values( 'O' );
insert into test(s) values( 'p' );
insert into test(s) values( 'P' );
insert into test(s) values( 'r' );
insert into test(s) values( 'R' );
insert into test(s) values( 's' );
insert into test(s) values( 'S' );
insert into test(s) values( 'P' );
insert into test(s) values( 'r' );
insert into test(s) values( 'R' );
insert into test(s) values( 's' );
insert into test(s) values( 'S' );
insert into test(s) values( 'š' );
insert into test(s) values( 'Š' );
@ -140,23 +128,23 @@ test_script_1 = """
insert into test(s) values( 'Ö' );
insert into test(s) values( 'ü' );
insert into test(s) values( 'Ü' );
insert into test(s) values( 'x' );
insert into test(s) values( 'X' );
insert into test(s) values( 'y' );
insert into test(s) values( 'Y' );
insert into test(s) values( 'x' );
insert into test(s) values( 'X' );
insert into test(s) values( 'y' );
insert into test(s) values( 'Y' );
commit;
set heading off;
-- test-1:
-- test-1:
-- check whether letters are sorted properly when case- and accent-sensitive collation is in use:
-- values of row_number()over(order by a.s) must be equal to ID values.
select a.id,a.s,row_number()over(order by a.s) rn from test a;
-- test-2:
-- check that every character matches to some another (and single) with respect
-- check that every character matches to some another (and single) with respect
-- to requirement: "case insensitive, accent insensitive".
-- This means that for 'a' we must find 'A' (but NOT 'ä' or 'Ä') etc.
-- NOTE.
@ -166,115 +154,115 @@ test_script_1 = """
set count on;
select a.id, a.s, b.id, b.s
from test a
join test b on
join test b on
a.s collate estonian_coll_ci_ai = b.s collate estonian_coll_ci_ai
and a.id < b.id
order by a.id, b.id
;
;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' ')])
expected_stdout_1 = """
1 a 1
2 A 2
3 b 3
4 B 4
5 c 5
6 C 6
7 d 7
8 D 8
9 e 9
10 E 10
11 f 11
12 F 12
13 g 13
14 G 14
15 h 15
16 H 16
17 i 17
18 I 18
19 j 19
20 J 20
21 k 21
22 K 22
23 l 23
24 L 24
25 m 25
26 M 26
27 n 27
28 N 28
29 o 29
30 O 30
31 p 31
32 P 32
33 r 33
34 R 34
35 s 35
36 S 36
37 š 37
38 Š 38
39 z 39
40 Z 40
41 ž 41
42 Ž 42
43 t 43
44 T 44
45 u 45
46 U 46
47 v 47
48 V 48
49 õ 49
50 Õ 50
51 ä 51
52 Ä 52
53 ö 53
54 Ö 54
55 ü 55
56 Ü 56
57 x 57
58 X 58
59 y 59
60 Y 60
expected_stdout = """
1 a 1
2 A 2
3 b 3
4 B 4
5 c 5
6 C 6
7 d 7
8 D 8
9 e 9
10 E 10
11 f 11
12 F 12
13 g 13
14 G 14
15 h 15
16 H 16
17 i 17
18 I 18
19 j 19
20 J 20
21 k 21
22 K 22
23 l 23
24 L 24
25 m 25
26 M 26
27 n 27
28 N 28
29 o 29
30 O 30
31 p 31
32 P 32
33 r 33
34 R 34
35 s 35
36 S 36
37 š 37
38 Š 38
39 z 39
40 Z 40
41 ž 41
42 Ž 42
43 t 43
44 T 44
45 u 45
46 U 46
47 v 47
48 V 48
49 õ 49
50 Õ 50
51 ä 51
52 Ä 52
53 ö 53
54 Ö 54
55 ü 55
56 Ü 56
57 x 57
58 X 58
59 y 59
60 Y 60
1 a 2 A
3 b 4 B
5 c 6 C
7 d 8 D
9 e 10 E
11 f 12 F
13 g 14 G
15 h 16 H
17 i 18 I
19 j 20 J
21 k 22 K
23 l 24 L
25 m 26 M
27 n 28 N
29 o 30 O
31 p 32 P
33 r 34 R
35 s 36 S
37 š 38 Š
39 z 40 Z
41 ž 42 Ž
43 t 44 T
45 u 46 U
47 v 48 V
49 õ 50 Õ
51 ä 52 Ä
53 ö 54 Ö
55 ü 56 Ü
57 x 58 X
59 y 60 Y
1 a 2 A
3 b 4 B
5 c 6 C
7 d 8 D
9 e 10 E
11 f 12 F
13 g 14 G
15 h 16 H
17 i 18 I
19 j 20 J
21 k 22 K
23 l 24 L
25 m 26 M
27 n 28 N
29 o 30 O
31 p 32 P
33 r 34 R
35 s 36 S
37 š 38 Š
39 z 40 Z
41 ž 42 Ž
43 t 44 T
45 u 46 U
47 v 48 V
49 õ 50 Õ
51 ä 52 Ä
53 ö 54 Ö
55 ü 56 Ü
57 x 58 X
59 y 60 Y
Records affected: 30
Records affected: 30
"""
@pytest.mark.version('>=4.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1029
# title: Bad plan in outer joins with IS NULL clauses (dependent on order of predicates)
# decription:
# tracker_id: CORE-1029
# min_versions: []
# versions: 2.0.1
# qmid: bugs.core_1029
"""
ID: issue-1444
ISSUE: 1444
TITLE: ad plan in outer joins with IS NULL clauses (dependent on order of predicates)
DESCRIPTION:
JIRA: CORE-1029
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.1
# resources: None
substitutions_1 = []
init_script_1 = """create table tb1 (id int, col int) ;
init_script = """create table tb1 (id int, col int) ;
create index tbi1 on tb1 (id) ;
create index tbi2 on tb1 (col) ;
@ -27,9 +22,9 @@ insert into tb1 values (1, null) ;
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """set plan on;
test_script = """set plan on;
select * from tb1 a
left join tb1 b on a.id = b.id
@ -40,9 +35,9 @@ select * from tb1 a
where a.col+0 is null and a.col is null;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """PLAN JOIN (A INDEX (TBI2), B INDEX (TBI1))
expected_stdout = """PLAN JOIN (A INDEX (TBI2), B INDEX (TBI1))
ID COL ID COL
============ ============ ============ ============
@ -58,9 +53,9 @@ PLAN JOIN (A INDEX (TBI2), B INDEX (TBI1))
"""
@pytest.mark.version('>=2.0.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1033
# title: like doesn't work for computed values (at least in a view)
# decription:
# tracker_id: CORE-1033
# min_versions: []
# versions: 2.5
# qmid: bugs.core_1033
"""
ID: issue-1450
ISSUE: 1450
TITLE: LIKE doesn't work for computed values (at least in a view)
DESCRIPTION:
JIRA: CORE-1033
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5
# resources: None
substitutions_1 = []
init_script_1 = """create table TABLE_X (
init_script = """create table TABLE_X (
id numeric(10,0) not null,
descr varchar(50) not null
);
@ -34,9 +29,9 @@ insert into TABLE_X values (3,'xyz012');
commit;"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """select * from X_VW ;
test_script = """select * from X_VW ;
select * from X_VW where description like 'xyz (1)' ;
@ -45,36 +40,36 @@ select * from X_VW where description like 'xyz (%)' ;
select * from X_VW where description like 'xyz%' ;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
2 xyzxyz (2)
3 xyz012 (3)
expected_stdout = """
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
2 xyzxyz (2)
3 xyz012 (3)
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
2 xyzxyz (2)
3 xyz012 (3)
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
2 xyzxyz (2)
3 xyz012 (3)
"""
@pytest.mark.version('>=2.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,24 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1036
# title: extend retutnning support added in ver 2 in update record of table and in updateble view
# decription:
# Only basic support is checked here (i.e. only table and one-to-one projection view, WITHOUT trigger(s)).
#
# tracker_id: CORE-1036
# min_versions: ['3.0.0']
# versions: 3.0
# qmid: None
"""
ID: issue-1453
ISSUE: 1453
TITLE: Extend returning support added in ver 2 in update record of table and in updateble view
DESCRIPTION:
Only basic support is checked here (i.e. only table and one-to-one projection view,
WITHOUT trigger(s)).
JIRA: CORE-1036
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """
init_script = """
recreate view v_test as select 1 x from rdb$database;
commit;
@ -29,9 +24,9 @@ init_script_1 = """
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """
test_script = """
set list on;
insert into test(id, x, y) values(1,100,200);
commit;
@ -49,9 +44,9 @@ test_script_1 = """
delete from v_test where id < 0 returning x as v_deleted_x, y as v_deleted_y, z as v_deleted_z;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
T_INSERTED_X 11
T_INSERTED_Y 12
T_INSERTED_Z 23
@ -74,8 +69,8 @@ expected_stdout_1 = """
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1040
# title: Wrong single-segment ascending index on character field with NULL and empty string values
# decription: Wrong single-segment ascending index on character field with NULL and empty string values
# tracker_id: CORE-1040
# min_versions: []
# versions: 3.0
# qmid: bugs.core_1040
"""
ID: issue-1457
ISSUE: 1457
TITLE: Wrong single-segment ascending index on character field with NULL and empty string values
DESCRIPTION:
JIRA: CORE-1040
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """recreate table t (str varchar(10));
init_script = """recreate table t (str varchar(10));
commit;
insert into t values ('');
@ -27,21 +22,21 @@ create index t_i on t (str);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """select count(*) from t where str is null;"""
test_script = """select count(*) from t where str is null;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """ COUNT
expected_stdout = """ COUNT
=====================
1
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1055
# title: Wrong parameter matching for self-referenced procedures
# decription:
# tracker_id: CORE-1055
# min_versions: []
# versions: 2.0.1
# qmid: bugs.core_1055
"""
ID: issue-1474
ISSUE: 1474
TITLE: Wrong parameter matching for self-referenced procedures
DESCRIPTION:
JIRA: CORE-1055
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.1
# resources: None
substitutions_1 = []
init_script_1 = """SET TERM ^;
init_script = """SET TERM ^;
create procedure PN (p1 int)
as
@ -29,9 +24,9 @@ SET TERM ;^
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """SET TERM ^;
test_script = """SET TERM ^;
alter procedure PN (p1 int, p2 int)
as
@ -44,10 +39,11 @@ SET TERM ;^
commit;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@pytest.mark.version('>=2.0.1')
def test_1(act_1: Action):
act_1.execute()
act = isql_act('db', test_script)
@pytest.mark.version('>=3')
def test_1(act: Action):
try:
act.execute()
except ExecutionError as e:
pytest.fail("Test script execution failed", pytrace=False)

View File

@ -1,29 +1,24 @@
#coding:utf-8
#
# id: bugs.core_1056
# title: A query could produce different results, depending on the presence of an index
# decription:
# tracker_id: CORE-1056
# min_versions: []
# versions: 2.0
# qmid: bugs.core_1056
"""
ID: issue-1475
ISSUE: 1475
TITLE: A query could produce different results, depending on the presence of an index
DESCRIPTION:
JIRA: CORE-1056
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0
# resources: None
substitutions_1 = []
init_script_1 = """create table t (c varchar(10) character set win1250 collate pxw_csy);
init_script = """create table t (c varchar(10) character set win1250 collate pxw_csy);
insert into t values ('ch');
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """set plan on;
test_script = """set plan on;
select * from t where c starting with 'c';
commit;
@ -34,9 +29,9 @@ commit;
select * from t where c starting with 'c';
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
PLAN (T NATURAL)
C
@ -52,9 +47,9 @@ ch
"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3.0')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,40 +1,35 @@
#coding:utf-8
#
# id: bugs.core_1058
# title: ALTER DOMAIN and ALTER TABLE don't allow to change character set and/or collation
# decription:
# tracker_id: CORE-1058
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1058
"""
ID: issue-1479
ISSUE: 1479
TITLE: ALTER DOMAIN and ALTER TABLE don't allow to change character set and/or collation
DESCRIPTION:
JIRA: CORE-1058
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """CREATE DOMAIN D_TEST AS VARCHAR(100) CHARACTER SET WIN1251;
init_script = """CREATE DOMAIN D_TEST AS VARCHAR(100) CHARACTER SET WIN1251;
COMMIT;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """ALTER DOMAIN D_TEST TYPE VARCHAR(100) CHARACTER SET UTF8;
test_script = """ALTER DOMAIN D_TEST TYPE VARCHAR(100) CHARACTER SET UTF8;
COMMIT;
SHOW DOMAIN D_TEST;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """D_TEST VARCHAR(100) CHARACTER SET UTF8 Nullable
expected_stdout = """D_TEST VARCHAR(100) CHARACTER SET UTF8 Nullable
"""
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,26 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1063
# title: Server hangs eating CPU and performs huge I/O copying different codepage fields
# decription:
# tracker_id: CORE-1063
# min_versions: []
# versions: 2.0.1
# qmid: bugs.core_1063
"""
ID: issue-1484
ISSUE: 1484
TITLE: Server hangs eating CPU and performs huge I/O copying different codepage fields
DESCRIPTION:
JIRA: CORE-1063
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.1
# resources: None
db = db_factory(from_backup='core1063.fbk')
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(from_backup='core1063.fbk', init=init_script_1)
test_script_1 = """alter table cms_wiki
test_script = """alter table cms_wiki
add u_name varchar(100) character set UTF8,
add u_title varchar(100) character set UTF8,
add u_description blob sub_type 1 character set UTF8,
@ -54,9 +47,9 @@ set heading off;
select name from CMS_WIKI;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
.menu
awards.htm
affiliate_program.htm
@ -114,9 +107,9 @@ expected_stdout_1 = """
.menu_zonetick
"""
@pytest.mark.version('>=2.0.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,116 +1,32 @@
#coding:utf-8
#
# id: bugs.core_1073
# title: SINGULAR buggy when nulls present
# decription:
# tracker_id: CORE-1073
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1073
"""
ID: issue-1495
ISSUE: 1495
TITLE: SINGULAR buggy when nulls present
DESCRIPTION:
JIRA: CORE-1073
"""
import pytest
from firebird.qa import db_factory, python_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """create table t (a integer);
init_script = """create table t (a integer);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
# test_script_1
#---
# def check(step,cur,statement,exp):
# cur.execute(statement)
# r = cur.fetchone()
# if (exp and (r is None)) or (not exp and (r is not None)):
# print ('Test FAILED in step ',step,', expectation ',exp)
# print ('Statement:',statement)
#
# c = db_conn.cursor()
# p_singular = 'select 1 from rdb$database where singular(select * from t where a = 1)'
# n_singular = 'select 1 from rdb$database where not(singular(select * from t where a = 1))'
# p_nsingular = 'select 1 from rdb$database where not singular( select * from t where a = 1)'
# n_nsingular = 'select 1 from rdb$database where not(not singular(select * from t where a = 1))'
#
# ins = 'insert into t values (%s)'
#
# # Step 1
#
# c.execute(ins % '2')
# c.execute(ins % 'null')
# db_conn.commit()
#
# check(1,c,p_singular,False)
# check(1,c,n_singular,True)
# check(1,c,p_nsingular,True)
# check(1,c,n_nsingular,False)
#
# c.execute('delete from t')
# db_conn.commit()
#
# # Step 2
#
# c.execute(ins % '1')
# c.execute(ins % 'null')
# db_conn.commit()
#
# check(2,c,p_singular,True)
# check(2,c,n_singular,False)
# check(2,c,p_nsingular,False)
# check(2,c,n_nsingular,True)
#
# c.execute('delete from t')
# db_conn.commit()
#
# # Step 3
#
# c.execute(ins % '1')
# c.execute(ins % 'null')
# c.execute(ins % '1')
# db_conn.commit()
#
# check(3,c,p_singular,False)
# check(3,c,n_singular,True)
# check(3,c,p_nsingular,True)
# check(3,c,n_nsingular,False)
#
# c.execute('delete from t')
# db_conn.commit()
#
# # Step 4
#
# c.execute(ins % '1')
# c.execute(ins % '1')
# c.execute(ins % 'null')
# db_conn.commit()
#
# check(4,c,p_singular,False)
# check(4,c,n_singular,True)
# check(4,c,p_nsingular,True)
# check(4,c,n_nsingular,False)
#
# c.execute('delete from t')
# db_conn.commit()
#
#
#
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
act = python_act('db')
def check(step, cur, statement, exp):
r = cur.execute(statement).fetchone()
if (exp and (r is None)) or (not exp and (r is not None)):
pytest.fail(f'Test FAILED in step {step}, expectation {exp}')
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
with act_1.db.connect() as con:
@pytest.mark.version('>=3')
def test_1(act: Action):
with act.db.connect() as con:
c = con.cursor()
#
p_singular = 'select 1 from rdb$database where singular(select * from t where a = 1)'

View File

@ -1,180 +1,27 @@
#coding:utf-8
#
# id: bugs.core_1076
# title: gsec truncate First.Middle.Last Name fields to 17 chars instead of 32 chars available in field definition
# decription:
# FB2.0 correctly saves First, Middle & Last Name fields in the security database to the available length of 32 characters.
# FB1.5.3 and still now FB1.5.4RC1 truncates these field lengths to 17 chars.
# ---
# 11.01.2016: refactored for 3.0: use FBSVCMGR instead of GSEC. This was agreed with Alex, see his reply 11.01.2015 17:57.
#
#
# tracker_id: CORE-1076
# min_versions: []
# versions: 3.0
# qmid:
"""
ID: issue-1498
ISSUE: 1498
TITLE: Services Manager and gsec truncate First.Middle.Last Name fields to 17 chars instead of 32 chars available in field definition
DESCRIPTION:
NOTES:
[11.01.2016]
refactored for 3.0: use FBSVCMGR instead of GSEC. This was agreed with Alex, see his reply 11.01.2015 17:57.
JIRA: CORE-1076
"""
import pytest
from firebird.qa import db_factory, python_act, Action, user_factory, User
from firebird.qa import *
# version: 3.0
# resources: None
db = db_factory()
substitutions_1 = []
act = python_act('db')
init_script_1 = """"""
tmp_user = user_factory('db', name="Nebuchadnezzar2_King_of_Babylon",
password="Nebu_King_of_Babylon")
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
# import os
# import time
# import subprocess
# from subprocess import Popen
# from fdb import services
#
# os.environ["ISC_USER"] = user_name
# os.environ["ISC_PASSWORD"] = user_password
#
#
# #--------------------------------------------
#
# def flush_and_close(file_handle):
# # https://docs.python.org/2/library/os.html#os.fsync
# # If you're starting with a Python file object f,
# # first do f.flush(), and
# # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk.
# global os
#
# file_handle.flush()
# if file_handle.mode not in ('r', 'rb'):
# # otherwise: "OSError: [Errno 9] Bad file descriptor"!
# os.fsync(file_handle.fileno())
# file_handle.close()
#
# #--------------------------------------------
#
# def cleanup( f_names_list ):
# global os
# for i in range(len( f_names_list )):
# if os.path.isfile( f_names_list[i]):
# os.remove( f_names_list[i] )
#
# #--------------------------------------------
#
# db_name=db_conn.database_name
# db_conn.close()
#
# svc = services.connect(host='localhost')
# security_db_name = svc.get_security_database_path() # path+name of security DB
# svc.close()
#
# check_login="Nebuchadnezzar2_King_of_Babylon"
#
# f_svc_log=open( os.path.join(context['temp_directory'],'tmp_1076_fbsvc.log'), 'w')
# f_svc_err=open( os.path.join(context['temp_directory'],'tmp_1076_fbsvc.err'), 'w')
#
# f_svc_log.write("Try to add user.")
# f_svc_log.write("\\n")
# f_svc_log.seek(0,2)
#
# subprocess.call( [ context['fbsvcmgr_path']
# ,"localhost:service_mgr"
# ,"action_add_user"
# ,"dbname", security_db_name
# ,"sec_username", check_login
# ,"sec_password", "Nebu_King_of_Babylon"
# ]
# ,stdout=f_svc_log, stderr=f_svc_err
# )
#
# f_svc_log.seek(0,2)
# f_svc_log.write("\\n")
# f_svc_log.write("Try to modify user: change password and some attributes.")
# f_svc_log.write("\\n")
# f_svc_log.seek(0,2)
#
# subprocess.call( [ context['fbsvcmgr_path']
# ,"localhost:service_mgr"
# ,"action_modify_user"
# ,"dbname", security_db_name
# ,"sec_username", check_login
# ,"sec_firstname", "Nebuchadnezzar3_King_of_Babylon"
# ,"sec_middlename", "Nebuchadnezzar4_King_of_Babylon"
# ,"sec_lastname", "Nebuchadnezzar5_King_of_Babylon"
# ]
# ,stdout=f_svc_log, stderr=f_svc_err
# )
#
# f_svc_log.seek(0,2)
# f_svc_log.write("\\n")
# f_svc_log.write("All done.")
# f_svc_log.write("\\n")
#
# flush_and_close( f_svc_log )
# flush_and_close( f_svc_err )
#
# isql_txt=''' set list on;
# select sec$user_name, sec$first_name, sec$middle_name, sec$last_name from sec$users
# where upper(sec$user_name) = upper('%s');
# commit;
# drop user %s;
# ''' % (check_login, check_login)
#
# f_sql_txt=open( os.path.join(context['temp_directory'],'tmp_1076_isql.sql'), 'w')
# f_sql_txt.write(isql_txt)
# flush_and_close( f_sql_txt )
#
# f_sql_log=open( os.path.join(context['temp_directory'],'tmp_1076_isql.log'), 'w')
# f_sql_err=open( os.path.join(context['temp_directory'],'tmp_1076_isql.err'), 'w')
#
# subprocess.call( [ context['isql_path'], dsn, "-i", f_sql_txt.name ]
# ,stdout=f_sql_log
# ,stderr=f_sql_err
# )
#
# flush_and_close( f_sql_log )
# flush_and_close( f_sql_err )
#
# with open( f_svc_log.name,'r') as f:
# l = [l for l in f.readlines() if l.strip()]
#
# for line in l:
# print("SVC STDOUT: "+line )
#
# with open( f_svc_err.name,'r') as f:
# l = [l for l in f.readlines() if l.strip()]
#
# for line in l:
# print("SVC STDERR: "+line )
#
# with open( f_sql_log.name,'r') as f:
# l = [l for l in f.readlines() if l.strip()]
#
# for line in l:
# print("SQL STDOUT: "+line )
#
# with open( f_sql_err.name,'r') as f:
# l = [l for l in f.readlines() if l.strip()]
#
# for line in l:
# print("SQL STDERR: "+line )
#
# #############################################
#
# # Cleanup.
# time.sleep(1)
# cleanup( [i.name for i in (f_svc_log, f_svc_err, f_sql_log, f_sql_err, f_sql_txt)] )
#
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
user_1 = user_factory('db_1', name="Nebuchadnezzar2_King_of_Babylon",
password="Nebu_King_of_Babylon")
expected_stdout_1 = """
expected_stdout = """
SEC$USER_NAME NEBUCHADNEZZAR2_KING_OF_BABYLON
SEC$FIRST_NAME Nebuchadnezzar3_King_of_Babylon
SEC$MIDDLE_NAME Nebuchadnezzar4_King_of_Babylon
@ -182,20 +29,20 @@ SEC$LAST_NAME Nebuchadnezzar5_King_of_Babylon
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action, user_1: User):
with act_1.connect_server() as srv:
def test_1(act: Action, tmp_user: User):
with act.connect_server() as srv:
sec_db = srv.info.security_database
act_1.svcmgr(switches=['action_modify_user', 'dbname', sec_db,
'sec_username', user_1.name,
act.svcmgr(switches=['action_modify_user', 'dbname', sec_db,
'sec_username', tmp_user.name,
'sec_firstname', 'Nebuchadnezzar3_King_of_Babylon',
'sec_middlename', 'Nebuchadnezzar4_King_of_Babylon',
'sec_lastname', 'Nebuchadnezzar5_King_of_Babylon'])
#
act_1.script = f"""set list on;
act.script = f"""set list on;
select sec$user_name, sec$first_name, sec$middle_name, sec$last_name from sec$users
where upper(sec$user_name) = upper('{user_1.name}');
where upper(sec$user_name) = upper('{tmp_user.name}');
"""
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,34 +1,30 @@
#coding:utf-8
#
# id: bugs.core_1078
# title: View with equally named source fields not faisible
# decription:
# tracker_id: CORE-1078
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1078
"""
ID: issue-649
ISSUE: 649
TITLE: View with equally named source fields not faisible
DESCRIPTION:
JIRA: CORE-1078
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """create table t1(id integer, field1 integer);
init_script = """create table t1(id integer, field1 integer);
create table t2(id integer, field1 integer);
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """create view view1 as select t1.field1 as t1f1, t2.field1 as t2f1 from t1 JOIN t2 on t2.id = t1.id;
test_script = """create view view1 as select t1.field1 as t1f1, t2.field1 as t2f1 from t1 JOIN t2 on t2.id = t1.id;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.execute()
act = isql_act('db', test_script)
@pytest.mark.version('>=3')
def test_1(act: Action):
try:
act.execute()
except ExecutionError as e:
pytest.fail("Test script execution failed", pytrace=False)

View File

@ -1,26 +1,23 @@
#coding:utf-8
#
# id: bugs.core_1083
# title: User (not SYSDBA) what have privileges with grant option, can't revoke privileges, granted by other user or SYSDBA
# decription:
# tracker_id: CORE-1083
# min_versions: ['2.1.0']
# versions: 3.0
# qmid: bugs.core_1083
"""
ID: issue-1504
ISSUE: 1504
TITLE: User (not SYSDBA) what have privileges with grant option, can't revoke privileges, granted by other user or SYSDBA
DESCRIPTION:
JIRA: CORE-1083
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
substitutions = [('set echo .*', ''),
('-TMP\\$C1083 is not grantor of (UPDATE|Update|update) on TAB2 to ROLE1.',
'-TMP$C1083 is not grantor of UPDATE on TAB2 to ROLE1.')]
substitutions_1 = [('set echo .*', ''), ('-TMP\\$C1083 is not grantor of (UPDATE|Update|update) on TAB2 to ROLE1.', '-TMP$C1083 is not grantor of UPDATE on TAB2 to ROLE1.')]
db = db_factory()
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
-- Refactored 05-JAN-2016: removed dependency on recource 'test_user'.
-- Checked on WI-V3.0.0.32266 (SS/SC/CS).
-- Checked 06.08.2018: added 'substitutions' because different case if some words in error message
@ -37,7 +34,7 @@ test_script_1 = """
grant update (col1) on tab1 to tmp$c1083 with grant option;
grant update (col2) on tab2 to role1;
commit;
connect 'localhost:$(DATABASE_LOCATION)test.fdb' user 'TMP$C1083' password 'QweRtyUioP';
--set bail on;
set echo on;
@ -46,7 +43,7 @@ test_script_1 = """
revoke update(col2) on tab2 from role1;
set echo off;
commit;
connect 'localhost:$(DATABASE_LOCATION)test.fdb' user 'SYSDBA' password 'masterkey';
set echo on;
drop user tmp$c1083;
@ -55,15 +52,16 @@ test_script_1 = """
-- ('-TMP\\$C1083 is not grantor.*', '')
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script, substitutions=substitutions)
expected_stdout_1 = """
expected_stdout = """
grant update(col1) on tab1 to role1;
revoke update(col1) on tab1 from role1;
revoke update(col2) on tab2 from role1;
drop user tmp$c1083;
"""
expected_stderr_1 = """
expected_stderr = """
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-REVOKE failed
@ -71,10 +69,10 @@ expected_stderr_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_stderr == act_1.clean_expected_stderr
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.execute()
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)

View File

@ -1,26 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1089
# title: Wrong ordering with views, distinct, left join and order by
# decription:
# tracker_id: CORE-1089
# min_versions: ['2.0.6']
# versions: 2.0.6
# qmid: None
"""
ID: issue-1510
ISSUE: 1510
TITLE: Wrong ordering with views, distinct, left join and order by
DESCRIPTION:
JIRA: CORE-1089
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.6
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
create table fat(
idxxfat varchar(26) not null,
progfat int,
@ -43,7 +36,7 @@ test_script_1 = """
sca.idxxfat,
fat.idxxccb,
fat.ndonfat
from sca
from sca
left join fat on sca.idxxfat=fat.idxxfat;
@ -59,7 +52,7 @@ test_script_1 = """
-- test-1:
set list on;
select 'test-1' as msg, v.*
select 'test-1' as msg, v.*
from vw$_sca v
order by 2 desc;
commit;
@ -85,16 +78,16 @@ test_script_1 = """
set list on;
select 'test-2' as msg, v.*
select 'test-2' as msg, v.*
from test_view v
order by myfield1 desc;
commit;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
MSG test-1
IDXXSCA 2007.4
PROGSCA 4
@ -133,9 +126,9 @@ expected_stdout_1 = """
MYFIELD2 1
"""
@pytest.mark.version('>=2.0.6')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,50 +1,46 @@
#coding:utf-8
#
# id: bugs.core_1090
# title: Error msg "Could not find UNIQUE INDEX" when in fact one is present
# decription:
# tracker_id: CORE-1090
# min_versions: []
# versions: 3.0
# qmid: bugs.core_1090-250
"""
ID: issue-1511
ISSUE: 1511
TITLE: Error msg "Could not find UNIQUE INDEX" when in fact one is present
DESCRIPTION:
JIRA: CORE-1090
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """create table t (i integer not null);
init_script = """create table t (i integer not null);
create unique index ti on t(i);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """show table t;
test_script = """show table t;
show index ti;
create table t2 (i integer references t(i));
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """I INTEGER Not Null
expected_stdout = """I INTEGER Not Null
TI UNIQUE INDEX ON T(I)
"""
expected_stderr_1 = """Statement failed, SQLSTATE = 42000
expected_stderr = """Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE TABLE T2 failed
-could not find UNIQUE or PRIMARY KEY constraint in table T with specified columns
"""
@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_stderr == act_1.clean_expected_stderr
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.execute()
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)

View File

@ -1,43 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1095
# title: Support BETWEEN predicate for select expressions
# decription:
# Checked on WI-V3.0.2.32670, WI-T4.0.0.503 - all fine.
# NOTE. Plan with table name (instead of alias 'R_CHK') in 2nd line was:
# ===
# PLAN (R_CHK NATURAL)
# PLAN (RDB$DATABASE NATURAL) <<<< ??
# PLAN (R_OUT NATURAL)
# ===
# Fixed 28.01.2017 11:51 ("Preserve the alias after the relation/procedure node copying").
# https://github.com/FirebirdSQL/firebird/commit/36b86a02e5df20d82855fe1af00bac27022bbf8e
# https://github.com/FirebirdSQL/firebird/commit/cbe9ac071f187e7766c2a67fdf47683604361059
# Checked on WI-V3.0.2.32677, WI-T4.0.0.519
# Checked again 22.11.2017:
# 3.0.3.32837: OK, 2.781s.
# 3.0.3.32838: OK, 1.438s.
# 4.0.0.800: OK, 2.547s.
# 4.0.0.801: OK, 1.640s.
#
# tracker_id: CORE-1095
# min_versions: ['3.0.2']
# versions: 3.0.2
# qmid: None
"""
ID: issue-1517
ISSUE: 1517
TITLE: Support BETWEEN predicate for select expressions
DESCRIPTION:
JIRA: CORE-1095
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0.2
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
set sqlda_display on;
set planonly;
-- Before 3.0.2 following statement failed with:
@ -63,9 +39,9 @@ test_script_1 = """
;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
INPUT message field count: 2
01: sqltype: 580 INT64 Nullable scale: 0 subtype: 0 len: 8
: name: alias:
@ -105,8 +81,8 @@ expected_stdout_1 = """
"""
@pytest.mark.version('>=3.0.2')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1108
# title: Wrong results with GROUP BY on constants
# decription: This test may hang (or take very long time to finish) the server version 1.5.x
# tracker_id: CORE-1108
# min_versions: []
# versions: 3.0
# qmid: bugs.core_1108-21
"""
ID: issue-1528
ISSUE: 1528
TITLE: Wrong results with GROUP BY on constants
DESCRIPTION:
JIRA: CORE-1108
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE EMPLOYEE (
init_script = """CREATE TABLE EMPLOYEE (
EMP_NO SMALLINT,
JOB_COUNTRY VARCHAR(15));
@ -68,15 +63,15 @@ INSERT INTO EMPLOYEE (EMP_NO, JOB_COUNTRY) VALUES (145, 'USA');
COMMIT;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """Select 'Country:', Job_Country, Count(*)
test_script = """Select 'Country:', Job_Country, Count(*)
From Employee
Group By 1,2;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """CONSTANT JOB_COUNTRY COUNT
expected_stdout = """CONSTANT JOB_COUNTRY COUNT
======== =============== =====================
Country: Canada 1
Country: England 3
@ -89,8 +84,8 @@ Country: USA 33
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,47 +1,23 @@
#coding:utf-8
#
# id: bugs.core_1112
# title: Crash when dealing with a string literal longer than 32K
# decription: This test may crash the server
# tracker_id: CORE-1112
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1112
"""
ID: issue-1532
ISSUE: 1532
TITLE: Crash when dealing with a string literal longer than 32K
DESCRIPTION:
JIRA: CORE-1112
"""
import pytest
from firebird.qa import db_factory, python_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
db = db_factory()
substitutions_1 = []
act = python_act('db')
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
# c = db_conn.cursor()
# longstr = 'abc' * 10930
# try:
# c.execute("select * from rdb$database where '%s' = 'a'" % longstr)
# except:
# pass
#
# try:
# c.execute("select * from rdb$database where '%s' containing 'a'" % longstr)
# except:
# pass
# c.execute("select 'a' from rdb$database")
# print (c.fetchall())
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
with act_1.db.connect() as con:
@pytest.mark.version('>=3')
def test_1(act: Action):
with act.db.connect() as con:
c = con.cursor()
longstr = 'abc' * 10930
c.execute(f"select * from rdb$database where '{longstr}' = 'a'")

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +1,27 @@
#coding:utf-8
#
# id: bugs.core_1120
# title: Conversion from string to number is not standard compliant
# decription:
# tracker_id: CORE-1120
# min_versions: []
# versions: 2.5.0
# qmid: bugs.core_1120-250
"""
ID: issue-1541
ISSUE: 1541
TITLE: Conversion from string to number is not standard compliant
DESCRIPTION:
JIRA: CORE-1120
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5.0
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """select cast(5.6 as integer) from rdb$database;
test_script = """select cast(5.6 as integer) from rdb$database;
select cast('5.6' as integer) from rdb$database;
select cast('5,6' as integer) from rdb$database;
select cast('5,6,7 8 9' as integer) from rdb$database;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """CAST
expected_stdout = """CAST
============
6
@ -41,17 +34,18 @@ CAST
CAST
============
"""
expected_stderr_1 = """Statement failed, SQLSTATE = 22018
expected_stderr = """Statement failed, SQLSTATE = 22018
conversion error from string "5,6"
Statement failed, SQLSTATE = 22018
conversion error from string "5,6,7 8 9"
"""
@pytest.mark.version('>=2.5.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_stderr == act_1.clean_expected_stderr
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.execute()
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1122
# title: Recursive Query bug in FB2.1
# decription:
# tracker_id: CORE-1122
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1122
"""
ID: issue-1543
ISSUE: 1543
TITLE: Recursive Query bug in FB2.1
DESCRIPTION:
JIRA: CORE-1122
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """
init_script = """
recreate table tb_menus(
record_id integer,
parent_id integer,
@ -26,16 +21,16 @@ init_script_1 = """
menu_icon blob sub_type 0 segment size 80
);
commit;
insert into tb_menus values (0, null, 1, 'm1', null, null);
insert into tb_menus values (1, 0, 1, 'm1 - sub1', 'app1.exe', null);
insert into tb_menus values (2, 0, 1, 'm1 - sub2', 'app2.exe', null);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """
test_script = """
set list on;
-------------------- 1st query ------------------
with recursive
@ -50,9 +45,9 @@ test_script_1 = """
cast('' as varchar(255)) ident
from tb_menus
where parent_id is null
UNION ALL
select
m.parent_id,
m.record_id,
@ -78,9 +73,9 @@ test_script_1 = """
select menu_icon from tb_menus;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
PARENT_ID <null>
RECORD_ID 0
ORDER_ITEM 1
@ -108,9 +103,9 @@ expected_stdout_1 = """
MENU_ICON <null>
"""
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,42 +1,35 @@
#coding:utf-8
#
# id: bugs.core_1126
# title: UNION vs UTF8 literals : arithmetic exception is thrown
# decription:
# tracker_id: CORE-1126
# min_versions: []
# versions: 2.5
# qmid: bugs.core_1126
"""
ID: issue-1547
ISSUE: 1547
TITLE: Incorrect results when left join on subquery with constant column
DESCRIPTION:
JIRA: CORE-1126
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SELECT _UTF8 'Z' FROM RDB$DATABASE
test_script = """SELECT _UTF8 'Z' FROM RDB$DATABASE
UNION ALL
SELECT _UTF8 'A' FROM RDB$DATABASE;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """CONSTANT
expected_stdout = """CONSTANT
========
Z
A
"""
@pytest.mark.version('>=2.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1130
# title: Bad optimization -- <procedure> left join <subquery> (or <view>)
# decription:
# tracker_id:
# min_versions: []
# versions: 2.0.1
# qmid: bugs.core_1130
"""
ID: issue-1552
ISSUE: 1552
TITLE: Bad optimization -- <procedure> left join <subquery> (or <view>)
DESCRIPTION:
JIRA: CORE-1130
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.1
# resources: None
substitutions_1 = []
init_script_1 = """SET TERM ^;
init_script = """SET TERM ^;
create procedure p
returns (r int)
as
@ -29,9 +24,9 @@ SET TERM ;^
COMMIT;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """SET PLAN ON;
test_script = """SET PLAN ON;
select *
from p
left join ( select rdb$relation_id from rdb$relations ) r
@ -39,9 +34,9 @@ from p
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """PLAN JOIN (P NATURAL, R RDB$RELATIONS INDEX (RDB$INDEX_1))
expected_stdout = """PLAN JOIN (P NATURAL, R RDB$RELATIONS INDEX (RDB$INDEX_1))
R RDB$RELATION_ID
============ ===============
@ -49,9 +44,9 @@ expected_stdout_1 = """PLAN JOIN (P NATURAL, R RDB$RELATIONS INDEX (RDB$INDEX_1)
"""
@pytest.mark.version('>=2.0.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,26 +1,21 @@
#coding:utf-8
#
# id: bugs.core_1142
# title: Cannot alter generator's comment to the same value
# decription:
# tracker_id: CORE-1142
# min_versions: []
# versions: 2.0.2
# qmid: bugs.core_1142
"""
ID: issue-1564
ISSUE: 1564
TITLE: Cannot alter generator's comment to the same value
DESCRIPTION:
JIRA: CORE-1142
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.2
# resources: None
init_script = """create generator T;"""
substitutions_1 = []
db = db_factory(init=init_script)
init_script_1 = """create generator T;"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """comment on generator T is 'comment';
test_script = """comment on generator T is 'comment';
commit;
show comment on generator T;
comment on generator T is 'comment';
@ -31,16 +26,16 @@ commit;
show comment on generator T;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """COMMENT ON GENERATOR T IS comment;
expected_stdout = """COMMENT ON GENERATOR T IS comment;
COMMENT ON GENERATOR T IS comment;
COMMENT ON GENERATOR T IS different comment;
"""
@pytest.mark.version('>=2.0.2')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1145
# title: Server locks up while attempting to commit a deletion of an expression index
# decription: This test may lock up the server.
# tracker_id: CORE-1145
# min_versions: []
# versions: 2.0.2
# qmid: bugs.core_1145
"""
ID: issue-1567
ISSUE: 1567
TITLE: Server locks up while attempting to commit a deletion of an expression index
DESCRIPTION:
JIRA: CORE-1145
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.2
# resources: None
substitutions_1 = []
init_script_1 = """create table expt1 (col1 int);
init_script = """create table expt1 (col1 int);
create table expt2 (col2 int);
commit;
@ -32,9 +27,9 @@ create index iexpt2 on expt2 computed (col2 + 1);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """set plan on;
test_script = """set plan on;
select * from expt1 where col1 + 1 = 2;
select * from expt2 where col2 + 1 = 2;
commit;
@ -47,9 +42,9 @@ select * from expt2 where col2 + 1 = 2;
commit;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
PLAN (EXPT1 INDEX (IEXPT1))
COL1
@ -79,9 +74,9 @@ PLAN (EXPT2 NATURAL)
"""
@pytest.mark.version('>=2.0.2')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1146
# title: AV in rse\\invalidate_child_rpbs for recursive queies
# decription: This may crash the server with AV
# tracker_id: CORE-1146
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1146
"""
ID: issue-1568
ISSUE: 1568
TITLE: AV in rse\\invalidate_child_rpbs for recursive queies
DESCRIPTION:
JIRA: CORE-1146
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """
init_script = """
recreate table c (
id integer,
name varchar(100)
@ -29,9 +24,9 @@ init_script_1 = """
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """
test_script = """
-- Updated code to recent FB version: add prefixes to every field from the query
with recursive x as
(
@ -40,9 +35,9 @@ test_script_1 = """
from t inner join c c1 on c1.id = t.code
left join c c2 on c2.id = t.ownercode
where ownercode = 0
union all
select --x.step+1
t.id, t.ownercode, x.code, c2.name as ownclass, c1.name as class
from t inner join c c1 on c1.id = t.code
@ -53,10 +48,11 @@ test_script_1 = """
;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.execute()
act = isql_act('db', test_script)
@pytest.mark.version('>=3')
def test_1(act: Action):
try:
act.execute()
except ExecutionError as e:
pytest.fail("Test script execution failed", pytrace=False)

View File

@ -1,112 +1,37 @@
#coding:utf-8
#
# id: bugs.core_1148
# title: Every user can view server log using services API
# decription:
# Instead of usage 'resource:test_user' (as it was before) we create every time this test run user TMP$C1148
# and make test connect to database as this user in order to check ability to connect and get engine version.
# Then we parse engine version (is it 2.5 or 3.0 ?) and construct command to obtain Firebird log using FBSVCMGR
# (switches differ for 2.5 and 3.0! For 2.5 it must be: "action_get_ib_log", for 3.0: "action_get_fb_log").
# After that we try to extract firebird log using fbsvcmgr and this command is EXPECTED return error, so we log
# this message to separate file (and STDOUT is redirected to /dev/null).
# Finally, we check content of 1st and 2nd files and remove temply created user.
#
# tracker_id: CORE-1148
# min_versions: ['2.5.0']
# versions: 2.5
# qmid: bugs.core_1148
"""
ID: issue-1570
ISSUE: 1570
TITLE: Every user can view server log using services API
DESCRIPTION:
JIRA: CORE-1148
"""
import pytest
from firebird.qa import db_factory, python_act, Action, user_factory, User
from firebird.qa import *
from firebird.driver import DatabaseError
# version: 2.5
# resources: None
substitutions = [('ENGINE_VERSION .*', 'ENGINE_VERSION'),
('STDERR: UNABLE TO PERFORM OPERATION.*', 'STDERR: UNABLE TO PERFORM OPERATION'),
('STDERR: -YOU MUST HAVE SYSDBA RIGHTS AT THIS SERVER*', '')]
substitutions_1 = [('ENGINE_VERSION .*', 'ENGINE_VERSION'),
('STDERR: UNABLE TO PERFORM OPERATION.*', 'STDERR: UNABLE TO PERFORM OPERATION'),
('STDERR: -YOU MUST HAVE SYSDBA RIGHTS AT THIS SERVER*', '')]
db = db_factory()
init_script_1 = """"""
act = python_act('db', substitutions=substitutions)
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
#
#
# # Refactored 05-JAN-2016: removed dependency on recource 'test_user' because this lead to:
# # UNTESTED: bugs.core_2729
# # Add new user
# # Unexpected stderr stream received from GSEC.
# # (i.e. test remained in state "Untested" because of internal error in gsec while creating user 'test' from resource).
# # Checked on WI-V2.5.5.26952 (SC), WI-V3.0.0.32266 (SS/SC/CS).
#
# import os
# import subprocess
# import time
#
# # Obtain engine version:
# engine = str(db_conn.engine_version)
#
# db_conn.execute_immediate("create user tmp$c1148 password 'QweRtyUi'")
# db_conn.commit()
#
# if engine.startswith('2.5'):
# get_firebird_log_key='action_get_ib_log'
# else:
# get_firebird_log_key='action_get_fb_log'
#
# fn_nul = open(os.devnull, 'w')
# fn_err=open( os.path.join(context['temp_directory'],'tmp_1148_get_fb_log.err'), 'w')
# subprocess.call([ context['fbsvcmgr_path'],
# "localhost:service_mgr",
# "user","TMP$C1148","password","QweRtyUi",
# get_firebird_log_key
# ],
# stdout=fn_nul,
# stderr=fn_err
# )
# fn_nul.close()
# fn_err.close()
#
# # CLEANUP: drop user that was temp-ly created for this test:
# ##########
# db_conn.execute_immediate('drop user tmp$c1148')
# db_conn.commit()
#
# # Ouput error log: it should contain text about unable to perform operation.
# # NB: text in FB 4.0 was splitted, phrase "You must have SYSDBA rights..." is
# # printed on separate line. Checking for matching to this phrase can be skipped
# # (see 'substitutions' section below):
# with open( fn_err.name,'r') as f:
# for line in f:
# print("STDERR: "+line.upper())
#
# # Do not remove this pause: on Windows closing of handles can take some (small) time.
# # Otherwise Windows(32) access error can raise here.
# time.sleep(1)
#
# if os.path.isfile(fn_err.name):
# os.remove(fn_err.name)
#
#
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
user_1 = user_factory('db_1', name='TMP$C1148', password='QweRtyUi')
tmp_user = user_factory('db', name='TMP$C1148', password='QweRtyUi')
@pytest.mark.version('>=3.0')
def test_1(act_1: Action, user_1: User):
if act_1.is_version('<4'):
if act_1.platform == 'Windows':
def test_1(act: Action, tmp_user: User):
if act.is_version('<4'):
if act.platform == 'Windows':
pattern = 'Unable to perform operation'
else:
pattern = 'You must be either SYSDBA or owner of the database'
else:
pattern = 'You must have SYSDBA rights at this server'
with act_1.connect_server(user=user_1.name, password=user_1.password) as srv:
with act.connect_server(user=tmp_user.name, password=tmp_user.password) as srv:
with pytest.raises(DatabaseError, match=pattern):
srv.info.get_log()

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1150
# title: Error conversion error from string " " using outer join on int64 and int fields
# decription:
# tracker_id: CORE-1150
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1150
"""
ID: issue-1572
ISSUE: 1572
TITLE: Error conversion error from string " " using outer join on int64 and int fields
DESCRIPTION:
JIRA: CORE-1150
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE J (
init_script = """CREATE TABLE J (
ID INTEGER NOT NULL,
CODETABLE INTEGER,
CODEVSPTABLE INTEGER
@ -35,24 +30,24 @@ INSERT INTO TT(ID) VALUES(1);
COMMIT;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """SELECT 1
test_script = """SELECT 1
FROM TT T1 LEFT JOIN J ON J.CODETABLE = T1.ID
LEFT JOIN TT T2 ON J.CODEVSPTABLE = T2.ID ;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """CONSTANT
expected_stdout = """CONSTANT
============
1
"""
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,37 +1,33 @@
#coding:utf-8
#
# id: bugs.core_1152
# title: cannot erase a table with check constraints referencing more than a single columns
# decription:
# tracker_id: CORE-1152
# min_versions: []
# versions: 2.0
# qmid: bugs.core_1152
"""
ID: issue-1573
ISSUE: 1573
TITLE: Cannot erase a table with check constraints referencing more than a single columns
DESCRIPTION:
JIRA: CORE-1152
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE test(
init_script = """CREATE TABLE test(
int1 INTEGER,
int2 INTEGER,
CHECK(int1 IS NULL OR int2 IS NULL)
);
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """DROP TABLE test;
test_script = """DROP TABLE test;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.execute()
act = isql_act('db', test_script)
@pytest.mark.version('>=3.0')
def test_1(act: Action):
try:
act.execute()
except ExecutionError as e:
pytest.fail("Test script execution failed", pytrace=False)

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1153
# title: Activating index change "STARTING" working as "LIKE" in join condition
# decription:
# tracker_id: CORE-1153
# min_versions: []
# versions: 2.0.2
# qmid: bugs.core_1153
"""
ID: issue-1574
ISSUE: 1574
TITLE: Activating index change "STARTING" working as "LIKE" in join condition
DESCRIPTION:
JIRA: CORE-1153
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.2
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE D (
init_script = """CREATE TABLE D (
ID VARCHAR(40)
);
@ -49,9 +44,9 @@ CREATE INDEX M_IDX1 ON M COMPUTED BY (UPPER(ID));
COMMIT WORK;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """SET PLAN ON;
test_script = """SET PLAN ON;
ALTER INDEX D_IDX1 INACTIVE;
@ -70,9 +65,9 @@ left outer join d dd
order by mm.id ;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """PLAN SORT (JOIN (MM NATURAL, DD NATURAL))
expected_stdout = """PLAN SORT (JOIN (MM NATURAL, DD NATURAL))
MID DID
======================================== ========================================
@ -100,9 +95,9 @@ DDD Ddd <null>
"""
@pytest.mark.version('>=2.0.2')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,78 +1,51 @@
#coding:utf-8
#
# id: bugs.core_1156
# title: Prepare fails when having a parameter in a DSQL statement before a sub query
# decription:
# tracker_id: CORE-1156
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1156
"""
ID: issue-1577
ISSUE: 1577
TITLE: Prepare fails when having a parameter in a DSQL statement before a sub query
DESCRIPTION:
NOTES:
[19.1.2022]
Using WITH for prepare() call is important to dispose returned prepared statement before
connection is closed. Otherwise pytest will report unhandled exceptions in __del__ calls
as prepared statement objects are destructed at wrong time.
JIRA: CORE-1156
"""
import pytest
from firebird.qa import db_factory, python_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
db = db_factory()
substitutions_1 = []
act = python_act('db')
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
# c = db_conn.cursor()
# try:
# c.prep('select count(*) from rdb$database where ? < (select count(*) from rdb$database)')
# except:
# print ('Test FAILED in case 1')
#
# try:
# c.prep('select count(*) from rdb$database where (select count(*) from rdb$database) > ?')
# except:
# print ('Test FAILED in case 2')
#
# try:
# c.prep('select count(*) from rdb$database where ? < cast ((select count(*) from rdb$database) as integer)')
# except:
# print ('Test FAILED in case 3')
#
# try:
# c.prep('select count(*) from rdb$database where 0 < (select count(*) from rdb$database)')
# except:
# print ('Test FAILED in case 4')
#
# try:
# c.prep('select count(*) from rdb$database where cast (? as integer) < (select count(*) from rdb$database)')
# except:
# print ('Test FAILED in case 5')
#
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
with act_1.db.connect() as con:
@pytest.mark.version('>=3')
def test_1(act: Action):
with act.db.connect() as con:
c = con.cursor()
try:
c.prepare('select count(*) from rdb$database where ? < (select count(*) from rdb$database)')
with c.prepare('select count(*) from rdb$database where ? < (select count(*) from rdb$database)'):
pass
except:
pytest.fail('Test FAILED in case 1')
try:
c.prepare('select count(*) from rdb$database where (select count(*) from rdb$database) > ?')
with c.prepare('select count(*) from rdb$database where (select count(*) from rdb$database) > ?'):
pass
except:
pytest.fail('Test FAILED in case 2')
try:
c.prepare('select count(*) from rdb$database where ? < cast ((select count(*) from rdb$database) as integer)')
with c.prepare('select count(*) from rdb$database where ? < cast ((select count(*) from rdb$database) as integer)'):
pass
except:
pytest.fail('Test FAILED in case 3')
try:
c.prepare('select count(*) from rdb$database where 0 < (select count(*) from rdb$database)')
with c.prepare('select count(*) from rdb$database where 0 < (select count(*) from rdb$database)'):
pass
except:
pytest.fail('Test FAILED in case 4')
try:
c.prepare('select count(*) from rdb$database where cast (? as integer) < (select count(*) from rdb$database)')
with c.prepare('select count(*) from rdb$database where cast (? as integer) < (select count(*) from rdb$database)'):
pass
except:
pytest.fail('Test FAILED in case 5')

View File

@ -1,67 +1,61 @@
#coding:utf-8
#
# id: bugs.core_1162
# title: Problem altering numeric field type
# decription: create table tab ( a numeric(4,2) );
#
# insert into tab values (99.99);
#
# select * from tab;
#
# A
# =======
# 99.99
#
# alter table tab alter a type numeric(4,3);
#
# select * from tab;
#
# Statement failed, SQLCODE = -802
# arithmetic exception, numeric overflow, or string truncation
#
# Btw. the database is not "corrupted" too badly - you can revert the change back by alter table tab alter a type numeric(4,2);
# and the engine is clever enough to convert data from stored format to requested one directly, not through all intermediate format versions.
# tracker_id: CORE-1162
# min_versions: []
# versions: 3.0
# qmid: bugs.core_1162-250
"""
ID: issue-1585
ISSUE: 1585
TITLE: Problem altering numeric field type
DESCRIPTION:
create table tab (a numeric(4,2));
insert into tab values (99.99);
select * from tab;
A
=======
99.99
alter table tab alter a type numeric(4,3);
select * from tab;
Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation
BTW the database is not "corrupted" too badly - you can revert the change back by
alter table tab alter a type numeric(4,2);
and the engine is clever enough to convert data from stored format to requested one
directly, not through all intermediate format versions.
JIRA: CORE-1162
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """create table tab ( a numeric(4,2) );
test_script = """create table tab ( a numeric(4,2) );
insert into tab values (99.99);
alter table tab alter a type numeric(4,3);
select * from tab;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """A
expected_stdout = """A
=======
99.99
"""
expected_stderr_1 = """Statement failed, SQLSTATE = 42000
expected_stderr = """Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-ALTER TABLE TAB failed
-New scale specified for column A must be at most 2.
"""
@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_stderr == act_1.clean_expected_stderr
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.execute()
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1165
# title: WHEN <list of exceptions> tracks only the dependency on the first exception in PSQL
# decription:
# tracker_id: CORE-1165
# min_versions: []
# versions: 2.5.0
# qmid: bugs.core_1165-250
"""
ID: issue-1588
ISSUE: 1588
TITLE: WHEN <list of exceptions> tracks only the dependency on the first exception in PSQL
DESCRIPTION:
JIRA: CORE-1165
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5.0
# resources: None
substitutions_1 = []
init_script_1 = """recreate exception e1 'e1' ;
init_script = """recreate exception e1 'e1' ;
recreate exception e2 'e2' ;
set term ^;
@ -32,21 +27,22 @@ end^
set term ;^
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """show depend p;
test_script = """show depend p;
recreate exception e1 'e1';
recreate exception e2 'e2';
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """[P:Procedure]
expected_stdout = """[P:Procedure]
E2:Exception, E1:Exception
+++
"""
expected_stderr_1 = """Statement failed, SQLSTATE = 42000
expected_stderr = """Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-cannot delete
-EXCEPTION E1
@ -58,11 +54,11 @@ unsuccessful metadata update
-there are 1 dependencies
"""
@pytest.mark.version('>=2.5.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_stderr == act_1.clean_expected_stderr
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.execute()
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)

View File

@ -1,41 +1,35 @@
#coding:utf-8
#
# id: bugs.core_1167
# title: CHARACTER SET GBK is not installed
# decription: Default character set is GBK
# Create Table T1(ID integer, FName Varchar(20); -- OK
# Commit; ---Error Message: CHARACTER SET GBK is not installed
# tracker_id: CORE-1167
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1167
"""
ID: issue-1590
ISSUE: 1590
TITLE: CHARACTER SET GBK is not installed
DESCRIPTION:
Default character set is GBK
Create Table T1(ID integer, FName Varchar(20); -- OK
Commit; ---Error Message: CHARACTER SET GBK is not installed
JIRA: CORE-1167
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
db = db_factory(charset='GBK')
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(charset='GBK', sql_dialect=3, init=init_script_1)
test_script_1 = """Create Table T1(ID integer, FName Varchar(20) CHARACTER SET GBK);
test_script = """Create Table T1(ID integer, FName Varchar(20) CHARACTER SET GBK);
COMMIT;
SHOW TABLE T1;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """ID INTEGER Nullable
expected_stdout = """ID INTEGER Nullable
FNAME VARCHAR(20) Nullable
"""
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,39 +1,32 @@
#coding:utf-8
#
# id: bugs.core_1171
# title: isql exponential format of numbers has zero pad on windows
# decription:
# tracker_id: CORE-1171
# min_versions: ['2.1.3']
# versions: 2.1.3
# qmid: None
"""
ID: issue-1594
ISSUE: 1594
TITLE: ISQL exponential format of numbers has zero pad on windows
DESCRIPTION:
JIRA: CORE-1171
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1.3
# resources: None
db = db_factory()
substitutions_1 = []
test_script = """select cast ('-2.488355210669293e+39' as double precision) from rdb$database;"""
init_script_1 = """"""
act = isql_act('db', test_script)
db_1 = db_factory(page_size=4096, charset='UTF8', sql_dialect=3, init=init_script_1)
test_script_1 = """select cast ('-2.488355210669293e+39' as double precision) from rdb$database;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
expected_stdout = """
CAST
=======================
-2.488355210669293e+39
"""
@pytest.mark.version('>=2.1.3')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1172
# title: Symbols ignored for ES_ES_CI_AI collation
# decription:
# tracker_id: CORE-1172
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1172
"""
ID: issue-679
ISSUE: 679
TITLE: Symbols ignored for ES_ES_CI_AI collation
DESCRIPTION:
JIRA: CORE-1172
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE TABLE_A (
init_script = """CREATE TABLE TABLE_A (
FIELD_A VARCHAR(10) CHARACTER SET iso8859_1 COLLATE ES_ES_CI_AI
);
@ -39,9 +34,9 @@ INSERT INTO TABLE_B (FIELD_A) VALUES ('A');
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """INSERT INTO TABLE_A (FIELD_A) VALUES ('A.');
test_script = """INSERT INTO TABLE_A (FIELD_A) VALUES ('A.');
INSERT INTO TABLE_A (FIELD_A) VALUES ('A-');
INSERT INTO TABLE_A (FIELD_A) VALUES ('-A');
INSERT INTO TABLE_A (FIELD_A) VALUES ('(A)');
@ -56,10 +51,11 @@ INSERT INTO TABLE_B (FIELD_A) VALUES ('(A)a');
INSERT INTO TABLE_B (FIELD_A) VALUES ('Aa');
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.execute()
act = isql_act('db', test_script)
@pytest.mark.version('>=3')
def test_1(act: Action):
try:
act.execute()
except ExecutionError as e:
pytest.fail("Test script execution failed", pytrace=False)

View File

@ -1,33 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1173
# title: Expression index based on computed fields
# decription:
# Index based on COMPUTED-BY column must be taken in account by optimizer.
# 13.08.2020: replaced expected_stdout with only PLAN output (concrete data values no matter in this test).
# Checked on:
# 4.0.0.2151 SS: 1.475s.
# 3.0.7.33348 SS: 1.172s.
# 2.5.9.27150 SC: 0.311s.
#
# tracker_id:
# min_versions: ['2.5.4']
# versions: 2.5.4
# qmid: bugs.core_1173
"""
ID: issue-1595
ISSUE: 1595
TITLE: Expression index based on computed fields
DESCRIPTION: Index based on COMPUTED-BY column must be taken in account by optimizer.
JIRA: CORE-1173
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5.4
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
create sequence g;
recreate table test (
fcode integer not null,
@ -88,18 +74,18 @@ test_script_1 = """
set plan off;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
PLAN (TEST INDEX (TEST_ON_COMPUTED_FIELD_ASC))
PLAN (TEST INDEX (TEST_FDATE_FTIME_ASC))
PLAN (TEST INDEX (TEST_ON_COMPUTED_FIELD_DEC))
PLAN (TEST INDEX (TEST_FDATE_FTIME_DEC))
"""
@pytest.mark.version('>=2.5.4')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,36 +1,21 @@
#coding:utf-8
#
# id: bugs.core_1175
# title: Error "Data type unknown" when any UDF argument is a built-in function containing a DSQL parameter reference
# decription:
# For FB 2.5 and 3.x - this test uses UDF from ib_udf.
#
# 24.01.2019. Added separate code for running 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/
#
# Checked on:
# 4.0.0.1340: OK, 2.594s.
# 4.0.0.1378: OK, 5.579s.
#
# NOTE. Build 4.0.0.1172 (date: 25.08.2018) raises here:
# SQLCODE: -902... expression evaluation not supported...
# Invalid data type for division in dialect 3
# gdscode = 335544569.
#
# tracker_id: CORE-1175
# min_versions: []
# versions: 2.1, 4.0
# qmid: bugs.core_1175
"""
ID: issue-1597
ISSUE: 1597
TITLE: Error "Data type unknown" when any UDF argument is a built-in function containing a DSQL parameter reference
DESCRIPTION:
For FB 3.x - this test uses UDF from ib_udf.
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/
JIRA: CORE-1175
"""
import pytest
from firebird.qa import db_factory, python_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
# version: 3.0
init_script_1 = """DECLARE EXTERNAL FUNCTION rtrim
CSTRING(255)
@ -39,24 +24,13 @@ init_script_1 = """DECLARE EXTERNAL FUNCTION rtrim
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db_1 = db_factory(init=init_script_1)
# test_script_1
#---
# c = db_conn.cursor()
# try:
# c.prep('select * from RDB$DATABASE where RDB$CHARACTER_SET_NAME = rtrim(trim(?))')
# print ('Test PASSED!')
# except Exception,e:
# print ('Test FAILED!')
# print (e)
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
act_1 = python_act('db_1')
expected_stdout_1 = """Test PASSED!"""
@pytest.mark.version('>=2.1,<4.0')
@pytest.mark.version('>=3.0,<4.0')
def test_1(act_1: Action):
with act_1.db.connect() as con:
c = con.cursor()
@ -66,9 +40,6 @@ def test_1(act_1: Action):
pytest.fail('Test FAILED')
# version: 4.0
# resources: None
substitutions_2 = []
init_script_2 = """
-- See declaration sample in plugins\\udr\\UdfBackwardCompatibility.sql:
@ -88,24 +59,12 @@ init_script_2 = """
commit;
"""
db_2 = db_factory(sql_dialect=3, init=init_script_2)
db_2 = db_factory(init=init_script_2)
# test_script_2
#---
# \\
# c = db_conn.cursor()
# try:
# c.prep( 'select 1 from rdb$database where UDR40_frac( ? ) != UDR40_div( ?, ?) / ? ' )
# print ( 'Test PASSED!' )
# except Exception,e:
# print( 'Test FAILED!' )
# print( e )
#---
act_2 = python_act('db_2', substitutions=substitutions_2)
act_2 = python_act('db_2')
@pytest.mark.version('>=4.0')
def test_1(act_2: Action):
def test_2(act_2: Action):
with act_2.db.connect() as con:
c = con.cursor()
try:

View File

@ -1,36 +1,29 @@
#coding:utf-8
#
# id: bugs.core_1179
# title: "CH" and "LL" are not separate spanish alphabet letters since 1994
# decription:
# tracker_id: CORE-1179
# min_versions: ['2.1.7']
# versions: 2.1.7
# qmid: None
"""
ID: issue-1605
ISSUE: 1605
TITLE: "CH" and "LL" are not separate spanish alphabet letters since 1994
DESCRIPTION:
JIRA: CORE-1179
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1.7
# resources: None
db = db_factory(charset='UTF8')
substitutions_1 = [('=.*', '')]
init_script_1 = """"""
db_1 = db_factory(page_size=4096, charset='UTF8', sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
recreate table test_utf8(id int, esp varchar(10));
commit;
insert into test_utf8 values(-2,'CH');
insert into test_utf8 values(-1,'LL');
insert into test_utf8 values( 1,'C');
insert into test_utf8 values( 2,'CA');
insert into test_utf8 values( 3,'CZ');
insert into test_utf8 values( 5,'D');
insert into test_utf8 values( 6,'L');
insert into test_utf8 values( 7,'LA');
insert into test_utf8 values( 8,'LZ');
@ -47,7 +40,7 @@ test_script_1 = """
insert into test_iso values( 2,'CA');
insert into test_iso values( 3,'CZ');
insert into test_iso values( 5,'D');
insert into test_iso values( 6,'L');
insert into test_iso values( 7,'LA');
insert into test_iso values( 8,'LZ');
@ -58,40 +51,40 @@ test_script_1 = """
select id, esp from test_iso order by esp collate es_es;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script, substitutions=[('=.*', '')])
expected_stdout_1 = """
ID ESP
============ ==========
1 C
2 CA
-2 CH
3 CZ
5 D
6 L
7 LA
-1 LL
8 LZ
10 M
ID ESP
============ ==========
1 C
2 CA
-2 CH
3 CZ
5 D
6 L
7 LA
-1 LL
8 LZ
10 M
expected_stdout = """
ID ESP
============ ==========
1 C
2 CA
-2 CH
3 CZ
5 D
6 L
7 LA
-1 LL
8 LZ
10 M
ID ESP
============ ==========
1 C
2 CA
-2 CH
3 CZ
5 D
6 L
7 LA
-1 LL
8 LZ
10 M
"""
@pytest.mark.version('>=2.1.7')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,26 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1181
# title: Union returns inconsistent field names
# decription:
# tracker_id: CORE-1181
# min_versions: ['2.0.7']
# versions: 2.0.7
# qmid: None
"""
ID: issue-1607
ISSUE: 1607
TITLE: Union returns inconsistent field names
DESCRIPTION:
JIRA: CORE-1181
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.7
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
recreate table test1(id numeric(15, 2));
commit;
@ -34,26 +27,26 @@ test_script_1 = """
insert into test2 values(1e0); ---- do NOT use 0e0! something weird occurs on linux: aux '0' in fractional part!
commit;
set list on;
select id as test1_id
select id as test1_id
from test1
group by id
union
select cast(0 as numeric(15,2))
from rdb$database;
-----------------------------------
select id as test2_id
select id as test2_id
from test2
group by id
union
select cast(1 as double precision)
from rdb$database;
@ -61,16 +54,16 @@ test_script_1 = """
-- Results were checked both on dialect 1 & 3, they are identical.
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
TEST1_ID 0.00
TEST2_ID 1.000000000000000
"""
@pytest.mark.version('>=2.0.7')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1183
# title: View cannot be created if its WHERE clause contains IN <subquery> with a procedure reference
# decription:
# tracker_id: CORE-1183
# min_versions: []
# versions: 2.0.2
# qmid: bugs.core_1183
"""
ID: issue-1609
ISSUE: 1609
TITLE: View cannot be created if its WHERE clause contains IN <subquery> with a procedure reference
DESCRIPTION:
JIRA: CORE-1183
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.0.2
# resources: None
substitutions_1 = []
init_script_1 = """
init_script = """
set term ^;
create or alter procedure p
returns (col int)
@ -27,7 +22,7 @@ init_script_1 = """
end^
set term ;^
commit;
create or alter view v
as
select
@ -39,25 +34,25 @@ init_script_1 = """
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """
test_script = """
set list on;
select v_descr, sign(v_rel_id) as v_rel_id, v_cset_name
from v;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
V_DESCR <null>
V_REL_ID 1
V_CSET_NAME NONE
V_CSET_NAME NONE
"""
@pytest.mark.version('>=2.0.2')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,26 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1188
# title: Select Starting with :Param (Empty string) doesn't work if using index with many fields
# decription:
# tracker_id: CORE-1188
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
"""
ID: issue-1613
ISSUE: 1613
TITLE: Select Starting with :Param (Empty string) doesn't work if using index with many fields
DESCRIPTION:
JIRA: CORE-1188
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
-- NB! As of 17.04.2015 this ticket resolves trouble only for FB-3.0.
-- Build WI-V2.5.4.26857 returns NO rows!
-- 23.10.2016: WI-V2.5.7.27026 - result the same (bad).
@ -41,8 +34,8 @@ test_script_1 = """
set term ^;
execute block returns(
msg varchar(10),
f01 type of column test_1.f01,
msg varchar(10),
f01 type of column test_1.f01,
f02 type of column test_1.f02
) as
declare v_stt1 varchar(255);
@ -80,7 +73,7 @@ test_script_1 = """
set term ^;
execute block returns(
msg varchar(10),
f01 type of column test_2.field_id,
f01 type of column test_2.field_id,
f02 type of column test_2.field_desc,
f03 type of column test_2.field_sel
) as
@ -101,9 +94,9 @@ test_script_1 = """
set term ;^
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
MSG test_1
F01 a
F02 b
@ -125,8 +118,8 @@ expected_stdout_1 = """
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

File diff suppressed because one or more lines are too long

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1213
# title: CURRENT OF support views
# decription:
# tracker_id: CORE-1213
# min_versions: []
# versions: 2.1.0
# qmid: bugs.core_1213
"""
ID: issue-1637
ISSUE: 1637
TITLE: CURRENT OF support views
DESCRIPTION:
JIRA: CORE-1213
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1.0
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE TAB1 (COL1 INTEGER);
init_script = """CREATE TABLE TAB1 (COL1 INTEGER);
CREATE VIEW V1 (COL1) AS SELECT COL1 FROM TAB1;
COMMIT;
INSERT INTO TAB1 (COL1) VALUES (1);
@ -37,16 +32,16 @@ COMMIT ^
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """SELECT COL1 FROM V1;
test_script = """SELECT COL1 FROM V1;
EXECUTE PROCEDURE P1;
SELECT COL1 FROM V1;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
COL1
============
1
@ -60,9 +55,9 @@ expected_stdout_1 = """
"""
@pytest.mark.version('>=2.1.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1215
# title: Wrong SELECT query results using index to evaluate >= condition
# decription:
# tracker_id: CORE-1215
# min_versions: []
# versions: 3.0
# qmid: bugs.core_1215
"""
ID: issue-1639
ISSUE: 1639
TITLE: Wrong SELECT query results using index to evaluate >= condition
DESCRIPTION:
JIRA: CORE-1215
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE T (ID INT);
init_script = """CREATE TABLE T (ID INT);
COMMIT;
set term ^;
@ -38,18 +33,18 @@ CREATE INDEX IDX_T ON T (ID);
COMMIT;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """set plan on;
test_script = """set plan on;
SELECT COUNT(*) FROM T ;
SELECT COUNT(*) FROM T WHERE ID >= 1 ;
SELECT COUNT(*) FROM T WHERE ID = 1 ;
SELECT COUNT(*) FROM T WHERE ID <= 1 ;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """PLAN (T NATURAL)
expected_stdout = """PLAN (T NATURAL)
COUNT
=====================
@ -76,8 +71,8 @@ PLAN (T INDEX (IDX_T))
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,40 +1,35 @@
#coding:utf-8
#
# id: bugs.core_1227
# title: LIST() function seems not work if used twice or more in a query
# decription: f I try to use the LIST() function twice or more in a query the following error occurs:
#
# Undefined name.
# Dynamic SQL Error.
# SQL error code = -204.
# Implementation limit exceeded.
# Block size exceeds implementation restriction.
# tracker_id: CORE-1227
# min_versions: []
# versions: 3.0
# qmid: bugs.core_1227
"""
ID: issue-1651
ISSUE: 1651
TITLE: LIST() function seems not work if used twice or more in a query
DESCRIPTION:
If I try to use the LIST() function twice or more in a query the following error occurs:
Undefined name.
Dynamic SQL Error.
SQL error code = -204.
Implementation limit exceeded.
Block size exceeds implementation restriction.
JIRA: CORE-1227
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE TESTTABLE (ID integer, FIELD1 char(5), FIELD2 char(20));
init_script = """CREATE TABLE TESTTABLE (ID integer, FIELD1 char(5), FIELD2 char(20));
INSERT INTO TESTTABLE VALUES (1,'aaaaa','bbbbbbbbb');
INSERT INTO TESTTABLE VALUES (1,'ccccc','ddddddddd');
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """SELECT LIST(FIELD1), LIST(FIELD2) FROM TESTTABLE GROUP BY ID;
test_script = """SELECT LIST(FIELD1), LIST(FIELD2) FROM TESTTABLE GROUP BY ID;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """ LIST LIST
expected_stdout = """ LIST LIST
================= =================
0:1 0:2
==============================================================================
@ -49,8 +44,8 @@ bbbbbbbbb ,ddddddddd
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,30 +1,25 @@
#coding:utf-8
#
# id: bugs.core_1244
# title: Server crash on select * from <recursive CTE>
# decription: Simple select from recursive CTE crashes the server when query uses asterisk.
# tracker_id: CORE-1244
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1244
"""
ID: issue-1668
ISSUE: 1668
TITLE: Server crash on select * from <recursive CTE>
DESCRIPTION: Simple select from recursive CTE crashes the server when query uses asterisk.
JIRA: CORE-1244
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE ARTICLES (ARTICLEID integer, PARENTID integer);
init_script = """CREATE TABLE ARTICLES (ARTICLEID integer, PARENTID integer);
COMMIT;
INSERT INTO ARTICLES VALUES (1,NULL);
INSERT INTO ARTICLES VALUES (2,1);
COMMIT;"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """with recursive
test_script = """with recursive
Art_Tree as (
select A.ArticleID
from Articles A
@ -40,18 +35,18 @@ select *
from Art_Tree;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """ARTICLEID
expected_stdout = """ARTICLEID
============
1
2
"""
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1245
# title: Incorrect column values with outer joins and views
# decription:
# tracker_id: CORE-1245
# min_versions: []
# versions: 2.5.0
# qmid: None
"""
ID: issue-1669
ISSUE: 1669
TITLE: Incorrect column values with outer joins and views
DESCRIPTION:
JIRA: CORE-1245
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5.0
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE T1 (N INTEGER);
init_script = """CREATE TABLE T1 (N INTEGER);
CREATE TABLE T2 (N INTEGER);
CREATE VIEW V (N1, N2, N3) AS
select t1.n, t2.n, 3
@ -30,18 +25,18 @@ insert into t1 values (2);
insert into t2 values (2);
"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """select rdb$relation_id, v.rdb$db_key, v.*
test_script = """select rdb$relation_id, v.rdb$db_key, v.*
from rdb$database
full outer join v
on (1 = 0)
;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
RDB$RELATION_ID DB_KEY N1 N2 N3
=============== ================================ ============ ============ ============
<null> 81000000010000008000000002000000 2 2 3
@ -50,9 +45,9 @@ RDB$RELATION_ID DB_KEY N1 N2
"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1246
# title: Incorrect column values with outer joins and derived tables
# decription:
# tracker_id: CORE-1246
# min_versions: []
# versions: 2.5.0
# qmid: None
"""
ID: issue-1670
ISSUE: 1670
TITLE: Incorrect column values with outer joins and derived tables
DESCRIPTION:
JIRA: CORE-1246
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5.0
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE T1 (N INTEGER);
init_script = """CREATE TABLE T1 (N INTEGER);
CREATE TABLE T2 (N INTEGER);
insert into t1 values (1);
@ -24,9 +19,9 @@ insert into t1 values (2);
insert into t2 values (2);
commit;"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """select *
test_script = """select *
from (select 1 n from rdb$database) t1
full join (select 2 n from rdb$database) t2
on (t2.n = t1.n)
@ -34,9 +29,9 @@ test_script_1 = """select *
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
N N
============ ============
<null> 2
@ -44,9 +39,9 @@ expected_stdout_1 = """
"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,39 +1,32 @@
#coding:utf-8
#
# id: bugs.core_1248
# title: Incorrect timestamp arithmetic when one of operands is negative number
# decription:
# tracker_id: CORE-1248
# min_versions: ['3.0.0']
# versions: 3.0
# qmid:
"""
ID: issue-1672
ISSUE: 1672
TITLE: Incorrect timestamp arithmetic when one of operands is negative number
DESCRIPTION:
JIRA: CORE-1248
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
set heading off;
select cast('04.05.2007' as timestamp) - (-7) from rdb$database;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
2007-05-11 00:00:00.0000
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,67 +1,28 @@
#coding:utf-8
#
# id: bugs.core_1249
# title: Full shutdown mode doesn't work on Classic if there are other connections to the database
# decription: This bug affects only Windows CS, but we'll test all platforms and architectures anyway.
# tracker_id: CORE-1249
# min_versions: []
# versions: 2.0.2
# qmid: bugs.core_1249
"""
ID: issue-1673
ISSUE: 1673
TITLE: Full shutdown mode doesn't work on Classic if there are other connections to the database
DESCRIPTION:
JIRA: CORE-1249
"""
import pytest
from firebird.qa import db_factory, python_act, Action
from firebird.qa import *
from firebird.driver import ShutdownMode, ShutdownMethod, DatabaseError
# version: 2.0.2
# resources: None
db = db_factory()
substitutions_1 = []
act = python_act('db')
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
#
# cur1 = db_conn.cursor()
# #cur1.execute('select 1 from rdb$database')
# runProgram('gfix',[dsn,'-user',user_name,'-pas',user_password,'-shut','full','-force','0'])
#
# try:
# cur1.execute('select 1 from rdb$database')
# print ('BUG! Operation allowed after shutdown!')
# except Exception, e:
# print("OK: operation not allowed.")
# print( ' '.join( ( 'Exception', ('DOES' if 'shutdown' in e[0] else 'does NOT'), 'contain text about shutdown.') ) )
# if 'shutdown' not in e[0]:
# print(e[0])
#
# # Error while starting transaction:
# # - SQLCODE: -902
# # - connection shutdown
# # - Database is shutdown. <<<<<<<<<<<<<<<<<<<< NEW message in 4.0
# #
# # Following messages can appear now after 'connection shutdown' (letter from dimitr, 08-may-2017 20:41):
# # isc_att_shut_killed: Killed by database administrator
# # isc_att_shut_idle: Idle timeout expired
# # isc_att_shut_db_down: Database is shutdown
# # isc_att_shut_engine: Engine is shutdown
#
# runProgram('gfix',[dsn,'-user',user_name,'-pas',user_password,'-online'])
#
# # 'substitutions': [('^.*shutdown','shutdown')]
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
@pytest.mark.version('>=2.0.2')
def test_1(act_1: Action):
with act_1.connect_server() as srv, act_1.db.connect() as con:
srv.database.shutdown(database=act_1.db.db_path, mode=ShutdownMode.FULL,
@pytest.mark.version('>=3')
def test_1(act: Action):
with act.connect_server() as srv, act.db.connect() as con:
srv.database.shutdown(database=act.db.db_path, mode=ShutdownMode.FULL,
method=ShutdownMethod.FORCED, timeout=0)
c = con.cursor()
with pytest.raises(DatabaseError, match='.*shutdown'):
c.execute('select 1 from rdb$database')
#
srv.database.bring_online(database=act_1.db.db_path)
srv.database.bring_online(database=act.db.db_path)

View File

@ -1,35 +1,30 @@
#coding:utf-8
#
# id: bugs.core_1253
# title: LIST(DISTINCT) concatenate VARCHAR values as CHAR
# decription:
# tracker_id: CORE-1253
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1253
"""
ID: issue-1677
ISSUE: 1677
TITLE: LIST(DISTINCT) concatenate VARCHAR values as CHAR
DESCRIPTION:
JIRA: CORE-1253
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE T1 (C1 varchar(5));
init_script = """CREATE TABLE T1 (C1 varchar(5));
COMMIT;
INSERT INTO T1 VALUES ('1');
INSERT INTO T1 VALUES ('2');
COMMIT;"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """select list(distinct c1) from t1;
test_script = """select list(distinct c1) from t1;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """LIST
expected_stdout = """LIST
=================
0:1
==============================================================================
@ -39,9 +34,9 @@ LIST:
"""
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1254
# title: Problem with DISTINCT and insensitive collations
# decription:
# tracker_id: CORE-1254
# min_versions: ['2.5']
# versions: 2.5.0
# qmid: None
"""
ID: issue-1678
ISSUE: 1678
TITLE: Problem with DISTINCT and insensitive collations
DESCRIPTION:
JIRA: CORE-1254
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5.0
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE TEST
init_script = """CREATE TABLE TEST
(GROUP_ID VARCHAR(1) CHARACTER SET UTF8 COLLATE UNICODE_CI,
QUESTION INTEGER,
SCORE INTEGER);
@ -31,14 +26,14 @@ COMMIT;
"""
db_1 = db_factory(page_size=4096, charset='UTF8', sql_dialect=3, init=init_script_1)
db = db_factory(charset='UTF8', init=init_script)
test_script_1 = """SELECT GROUP_ID, QUESTION, SUM(SCORE) FROM TEST GROUP BY 1,2;
test_script = """SELECT GROUP_ID, QUESTION, SUM(SCORE) FROM TEST GROUP BY 1,2;
SELECT DISTINCT GROUP_ID, QUESTION FROM TEST;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
GROUP_ID QUESTION SUM
======== ============ =====================
a 1 2
@ -54,9 +49,9 @@ a 3
"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,45 +1,37 @@
#coding:utf-8
#
# id: bugs.core_1255
# title: String truncation error when concatenating _UTF8 string onto extract(year result
# decription: The query
#
# SELECT ((EXTRACT(YEAR FROM CAST('2007-01-01' AS DATE)) || _UTF8'')) col FROM rdb$database GROUP BY 1;
#
# Produces the error
# Statement failed, SQLCODE = -802
# arithmetic exception, numeric overflow, or string truncation
# tracker_id: CORE-1255
# min_versions: []
# versions: 3.0
# qmid: bugs.core_1255
import pytest
from firebird.qa import db_factory, isql_act, Action
"""
ID: issue-1679
ISSUE: 1679
TITLE: String truncation error when concatenating _UTF8 string onto extract(year result
DESCRIPTION:
SELECT ((EXTRACT(YEAR FROM CAST('2007-01-01' AS DATE)) || _UTF8'')) col FROM rdb$database GROUP BY 1;
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SELECT ((EXTRACT(YEAR FROM CAST('2007-01-01' AS DATE)) || _UTF8'')) col FROM rdb$database GROUP BY 1;
Produces the error
Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation
JIRA: CORE-1255
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
import pytest
from firebird.qa import *
expected_stdout_1 = """COL
db = db_factory()
test_script = """SELECT ((EXTRACT(YEAR FROM CAST('2007-01-01' AS DATE)) || _UTF8'')) col FROM rdb$database GROUP BY 1;
"""
act = isql_act('db', test_script)
expected_stdout = """COL
======
2007
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,27 +1,22 @@
#coding:utf-8
#
# id: bugs.core_1256
# title: Table columns hide destination variables of RETURNING INTO
# decription:
# tracker_id: CORE-1256
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1256
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """create table t (n integer) ;
"""
ID: issue-703
ISSUE: 703
TITLE: Table columns hide destination variables of RETURNING INTO
DESCRIPTION:
JIRA: CORE-1256
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
import pytest
from firebird.qa import *
test_script_1 = """set term ^;
init_script = """create table t (n integer) ;
"""
db = db_factory(init=init_script)
test_script = """set term ^;
-- ok
@ -44,9 +39,9 @@ end^
set term ;^
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
N
============
1
@ -58,9 +53,9 @@ expected_stdout_1 = """
"""
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,41 +1,21 @@
#coding:utf-8
#
# id: bugs.core_1263
# title: GSec incorrectly processes some switches
# decription:
# tracker_id: CORE-1263
# min_versions: []
# versions: 3.0
# qmid: bugs.core_1263
"""
ID: issue-1686
ISSUE: 1686
TITLE: GSec incorrectly processes some switches
DESCRIPTION:
JIRA: CORE-1263
"""
import pytest
from firebird.qa import db_factory, python_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
db = db_factory()
substitutions_1 = []
act = python_act('db')
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
# commands = """add BADPARAM -pa PWD
# add BADPARAM -pas PWD
# add BADPARAM -password PWD
# add BADPARAM -user USR
# add BADPARAM -database DB
# add BADPARAM -trusted
# quit
# """
# runProgram('gsec',['-user',user_name,'-pas',user_password],commands)
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
expected_stderr_1_a = """
expected_stderr_a = """
GSEC> invalid switch specified in interactive mode
GSEC> invalid switch specified in interactive mode
GSEC> invalid switch specified in interactive mode
@ -46,7 +26,7 @@ error in switch specifications
GSEC>
"""
commands_1 = """add BADPARAM -pa PWD
commands = """add BADPARAM -pa PWD
add BADPARAM -pas PWD
add BADPARAM -password PWD
add BADPARAM -user USR
@ -57,12 +37,12 @@ quit
@pytest.mark.version('>=3.0')
@pytest.mark.platform('Linux', 'Darwin')
def test_1_a(act_1: Action):
act_1.expected_stderr = expected_stderr_1_a
act_1.gsec(input=commands_1)
assert act_1.clean_stderr == act_1.clean_expected_stderr
def test_1_a(act: Action):
act.expected_stderr = expected_stderr_a
act.gsec(input=commands)
assert act.clean_stderr == act.clean_expected_stderr
expected_stderr_1_b = """
expected_stderr_b = """
GSEC> invalid switch specified in interactive mode
GSEC> invalid switch specified in interactive mode
GSEC> invalid switch specified in interactive mode
@ -74,10 +54,10 @@ GSEC>
@pytest.mark.version('>=3.0')
@pytest.mark.platform('Windows')
def test_1_b(act_1: Action):
act_1.expected_stderr = expected_stderr_1_b
act_1.gsec(input=commands_1)
assert act_1.clean_stderr == act_1.clean_expected_stderr
def test_1_b(act: Action):
act.expected_stderr = expected_stderr_b
act.gsec(input=commands)
assert act.clean_stderr == act.clean_expected_stderr

View File

@ -1,28 +1,23 @@
#coding:utf-8
#
# id: bugs.core_1267
# title: Small bug with default value for domains in PSQL
# decription:
# tracker_id: CORE-1267
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1267
"""
ID: issue-1689
ISSUE: 1689
TITLE: Small bug with default value for domains in PSQL
DESCRIPTION:
JIRA: CORE-1267
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """CREATE DOMAIN BIT AS SMALLINT CHECK (VALUE IN (0,1) OR VALUE IS NULL);
init_script = """CREATE DOMAIN BIT AS SMALLINT CHECK (VALUE IN (0,1) OR VALUE IS NULL);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
test_script_1 = """set term ^;
test_script = """set term ^;
EXECUTE BLOCK
RETURNS (
@ -35,18 +30,18 @@ END ^
set term ;^
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
ID
=======
<null>
"""
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,26 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1271
# title: Ceation of invalid procedures/triggers allowed
# decription: invalid procedures/triggers (with invalid plans, for example) was allowed to be created
# tracker_id: CORE-1271
# min_versions: []
# versions: 3.0
# qmid: bugs.core_1271-250
"""
ID: issue-1692
ISSUE: 1692
TITLE: Ceation of invalid procedures/triggers allowed
DESCRIPTION:
JIRA: CORE-1271
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
set term ^;
create procedure p returns (out int) as
begin
@ -37,17 +30,17 @@ test_script_1 = """
commit^
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stderr_1 = """
expected_stderr = """
Statement failed, SQLSTATE = 2F000
Error while parsing procedure P's BLR
-index RDB$INDEX_1 cannot be used in the specified plan
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_stderr == act_1.clean_expected_stderr
def test_1(act: Action):
act.expected_stderr = expected_stderr
act.execute()
assert act.clean_stderr == act.clean_expected_stderr

View File

@ -1,22 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1274
# title: Wrong results when PLAN MERGE is chosen and datatypes of the equality predicate arguments are different
# decription:
# tracker_id: CORE-1274
# min_versions: ['2.1.4']
# versions: 3.0
# qmid: None
"""
ID: issue-1695
ISSUE: 1695
TITLE: Wrong results when PLAN MERGE is chosen and datatypes of the equality predicate arguments are different
DESCRIPTION:
JIRA: CORE-1274
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """create table t1 (col1 int);
init_script = """create table t1 (col1 int);
create table t2 (col2 varchar(10));
commit;
@ -30,14 +25,14 @@ insert into t2 values ('20');
insert into t2 values ('3');
commit;"""
db_1 = db_factory(page_size=4096, charset='UTF8', sql_dialect=3, init=init_script_1)
db = db_factory(charset='UTF8', init=init_script)
test_script_1 = """select * from t1 join t2 on col1 = col2 ORDER by 1 DESC;
test_script = """select * from t1 join t2 on col1 = col2 ORDER by 1 DESC;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """
expected_stdout = """
COL1 COL2
============ ==========
100 100
@ -47,8 +42,8 @@ expected_stdout_1 = """
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,58 +1,41 @@
#coding:utf-8
#
# id: bugs.core_1286
# title: isql: zero divide + coredump when use "-pag 0" command switch & set heading on inside .sql script
# decription:
# tracker_id: CORE-1286
# min_versions: ['2.5.2']
# versions: 2.5.2
# qmid: bugs.core_1286
"""
ID: issue-4153
ISSUE: 4153
TITLE: isql: zero divide + coredump when use "-pag 0" command switch & set heading on inside .sql script
DESCRIPTION:
JIRA: CORE-3810
"""
import pytest
from firebird.qa import db_factory, python_act, Action
from firebird.qa import *
# version: 2.5.2
# resources: None
substitutions_1 = []
init_script_1 = """create table test(id int);
init_script = """create table test(id int);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
db = db_factory(init=init_script)
# test_script_1
#---
# script = """
# set heading on;
# select 1 as r from rdb$fields rows 1;
# -- Crash of ISQL (not server) is reproduced when make connect by ISQL of WI-V2.5.1.26351.
# -- After ISQL crash firebird.log contains: INET/inet_error: read errno = 10054
# """
# runProgram('isql',[dsn,'-pag','0','-user',user_name,'-pas',user_password],script)
#
#---
act = python_act('db')
act_1 = python_act('db_1', substitutions=substitutions_1)
expected_stdout_1 = """
expected_stdout = """
R
============
1
"""
test_script_1 = """
test_script = """
set heading on;
select 1 as r from rdb$fields rows 1;
-- Crash of ISQL (not server) is reproduced when make connect by ISQL of WI-V2.5.1.26351.
-- After ISQL crash firebird.log contains: INET/inet_error: read errno = 10054
"""
@pytest.mark.version('>=2.5.2')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.isql(switches=['-pag', '0'], input=test_script_1)
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.isql(switches=['-pag', '0'], input=test_script)
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,25 +1,17 @@
#coding:utf-8
#
# id: bugs.core_1291
# title: Can't transliterate character set when look at procedure text in database just created from script (and thus in ODS 11.1)
# decription:
# tracker_id: CORE-1291
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1291
"""
ID: issue-1712
ISSUE: 1712
TITLE: Can't transliterate character set when look at procedure text in database just created from script (and thus in ODS 11.1)
DESCRIPTION:
JIRA: CORE-1291
"""
import pytest
from firebird.qa import db_factory, python_act, Action
from firebird.qa import *
# version: 2.1
# resources: None
substitutions_1 = [('Use CONNECT or CREATE DATABASE to specify a database', ''),
('SQL> ', ''), ('CON> ', '')]
init_script_1 = """"""
test_script_1 = """
test_script = """
SET SQL DIALECT 3;
SET NAMES WIN1251;
CREATE DATABASE '%s' DEFAULT CHARACTER SET WIN1251;
@ -666,30 +658,11 @@ SHOW PROCEDURE PRC_EXPSUMM_8;
EXIT;
"""
db_1 = db_factory(do_not_create=True)
db = db_factory(do_not_create=True)
# test_script_1
#---
# import os
#
# script = """SET SQL DIALECT 3;
#
# SET NAMES WIN1251;
#
# CREATE DATABASE '%s'
# DEFAULT CHARACTER SET WIN1251;
# """ % dsn
#
# scriptfile = open(os.path.join(context['files_location'],'core_1291.sql'),'r')
# script = script + ''.join(scriptfile)
# scriptfile.close()
#
# runProgram('isql',['-user',user_name,'-pas',user_password],script)
#---
act = python_act('db')
act_1 = python_act('db_1', substitutions=substitutions_1)
expected_stdout_1 = """Procedure text:
expected_stdout = """Procedure text:
=============================================================================
DECLARE VARIABLE NDSDiv DOUBLE PRECISION;
DECLARE VARIABLE ID_ExportFieldDoc Integer;
@ -904,11 +877,11 @@ SUMMRUS OUTPUT DOUBLE PRECISION
SUMMDOC OUTPUT DOUBLE PRECISION
"""
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.isql(switches=[],
input=test_script_1 % act_1.db.dsn, connect_db=False, charset='WIN1251')
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.isql(switches=[],
input=test_script % act.db.dsn, connect_db=False, charset='WIN1251')
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,28 +1,19 @@
#coding:utf-8
#
# id: bugs.core_1292
# title: Can't create table using long username and UTF8 as attachment charset
# decription:
# Checked on: 4.0.0.1635 SS/CS; 3.0.5.33180 SS/CS; 2.5.9.27119 SC/SS
#
# tracker_id: CORE-1292
# min_versions: []
# versions: 2.5
# qmid: bugs.core_1292
"""
ID: issue-1713
ISSUE: 1713
TITLE: Can't create table using long username and UTF8 as attachment charset
DESCRIPTION:
JIRA: CORE-1292
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5
# resources: None
db = db_factory(charset='UTF8')
substitutions_1 = [('PRIV_LIST.*', '')]
init_script_1 = """"""
db_1 = db_factory(charset='UTF8', sql_dialect=3, init=init_script_1)
test_script_1 = """
test_script = """
set wng off;
-- Drop old account if it remains from prevoius run:
@ -59,7 +50,7 @@ test_script_1 = """
create table test(n int);
commit;
connect '$(DSN)' user 'SYSDBA' password 'masterkey';
set list on;
@ -77,16 +68,16 @@ test_script_1 = """
where upper(trim(p.rdb$relation_name)) = upper('test')
order by priv
)
group by usr_name, grantor, can_grant, tab_name,usr_type,obj_type;
group by usr_name, grantor, can_grant, tab_name,usr_type,obj_type;
commit;
drop user Nebuchadnezzar2_King_of_Babylon;
commit;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script, substitutions=[('PRIV_LIST.*', '')])
expected_stdout_1 = """
expected_stdout = """
USR_NAME NEBUCHADNEZZAR2_KING_OF_BABYLON
GRANTOR NEBUCHADNEZZAR2_KING_OF_BABYLON
CAN_GRANT 1
@ -96,9 +87,9 @@ expected_stdout_1 = """
D,I,R,S,U
"""
@pytest.mark.version('>=2.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout

View File

@ -1,38 +1,31 @@
#coding:utf-8
#
# id: bugs.core_1295
# title: Bad optimization of queries with DB_KEY
# decription:
# tracker_id: CORE-1295
# min_versions: ['2.5.3']
# versions: 2.5.3
# qmid: None
"""
ID: issue-1716
ISSUE: 1716
TITLE: Bad optimization of queries with DB_KEY
DESCRIPTION:
JIRA: CORE-1295
"""
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import *
# version: 2.5.3
# resources: None
db = db_factory()
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
test_script_1 = """SET PLANONLY;
test_script = """SET PLANONLY;
select * from rdb$relations where rdb$db_key = ? and rdb$relation_id = 0;
select * from rdb$relations where rdb$db_key = ? and rdb$relation_name = 'RDB$RELATIONS';"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
act = isql_act('db', test_script)
expected_stdout_1 = """PLAN (RDB$RELATIONS INDEX ())
expected_stdout = """PLAN (RDB$RELATIONS INDEX ())
PLAN (RDB$RELATIONS INDEX ())
"""
@pytest.mark.version('>=2.5.3')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout