From: <mak...@us...> - 2014-07-28 11:55:05
|
Revision: 59921 http://sourceforge.net/p/firebird/code/59921 Author: makowski Date: 2014-07-28 11:54:55 +0000 (Mon, 28 Jul 2014) Log Message: ----------- Fix for Firebird 2.5.3 Modified Paths: -------------- qa/fbt-repository/trunk/tests/bugs/core_0104.fbt qa/fbt-repository/trunk/tests/bugs/core_0501.fbt qa/fbt-repository/trunk/tests/bugs/core_1462.fbt qa/fbt-repository/trunk/tests/bugs/core_1559.fbt qa/fbt-repository/trunk/tests/functional/domain/create_41.fbt qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_02.fbt qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_03.fbt qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_04.fbt qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_08.fbt qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_09.fbt qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_15.fbt qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_17.fbt qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_18.fbt qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_02.fbt qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_04.fbt qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_12.fbt qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_13.fbt qa/fbt-repository/trunk/tests/functional/index/create_11.fbt qa/fbt-repository/trunk/tests/functional/table/create_06.fbt Modified: qa/fbt-repository/trunk/tests/bugs/core_0104.fbt =================================================================== --- qa/fbt-repository/trunk/tests/bugs/core_0104.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/bugs/core_0104.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -52,6 +52,30 @@ violation of PRIMARY or UNIQUE KEY constraint "INTEG_4" on table "TEST" -Problematic key value is ("ACOLUMN" = 1) """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """create table test (acolumn int not null primary key); +commit; +""", + 'test_type': 'ISQL', + 'test_script': """SET AUTODDL OFF; + +drop table test; +create table test (acolumn int not null primary key); + +commit; + +insert into test values (1); +insert into test values (1); + +commit; +""", + 'expected_stderr': """Statement failed, SQLSTATE = 23000 +violation of PRIMARY or UNIQUE KEY constraint "INTEG_4" on table "TEST" +-Problematic key value is ("ACOLUMN" = 1) +""" } ] } Modified: qa/fbt-repository/trunk/tests/bugs/core_0501.fbt =================================================================== --- qa/fbt-repository/trunk/tests/bugs/core_0501.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/bugs/core_0501.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -1,5 +1,5 @@ { -'id': 'bugs.core_501', +'id': 'bugs.core_0501', 'qmid': None, 'tracker_id': 'CORE-501', 'title': 'Problem with COALESCE', @@ -485,6 +485,457 @@ -SQLDA missing or incorrect version, or incorrect number/type of variables """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'page_size': '4096', + 'init_script': """create sequence s1; +""", + 'test_type': 'ISQL', + 'test_script': """-- test computed expressions +create table t1 ( + n integer primary key, + x integer, + cn computed by (coalesce(n + 0, null)), + cx computed by (coalesce(x + 0, null)) +); + +-- test update or insert +update or insert into t1 values (next value for s1, 10); +update or insert into t1 values (next value for s1, 20); +update or insert into t1 values (next value for s1, 30); + +select * from t1; + +-- test sequence value after update or insert +select gen_id(s1, 0) from rdb$database; + +-- test update or insert using coalesce +update or insert into t1 + values (coalesce((select first 1 n from t1 order by n), null), coalesce(40 + 60, 0)); + +-- test update or insert in PSQL +set term ^ ; +execute block returns (n integer, x integer, cn integer, cx integer) +as + declare z integer = 200; +begin + update or insert into t1 + values (coalesce((select first 1 skip 1 n from t1 order by n), null), :z); + + for select n, x, cn, cx from t1 into n, x, cn, cx do + suspend; +end^ + +set term ; ^ + +select gen_id(s1, 0) from rdb$database; + +-- test view +create view v1 as + select t1.*, coalesce(n + 0, null) vcn from t1; + +select * from v1; + +-- test update or insert into a view +update or insert into v1 values (next value for s1, 40); + +-- test update or insert into a view in PSQL +set term ^ ; + +execute block returns (n integer, x integer, cn integer, cx integer) +as + declare z integer = 300; +begin + update or insert into v1 values ((select first 1 skip 2 n from t1 order by n), :z); + + for select n, x, cn, cx from v1 into n, x, cn, cx do + suspend; +end^ + + +-- test view trigger +create trigger v1_bi before insert on v1 +as + declare z integer = 1000; +begin + insert into t1 values (coalesce(new.n + :z, null), new.x); +end^ + +set term ; ^ + +insert into v1 values (8, 88); + +select * from v1; + +-- test coalesce +select coalesce(n * 1, null) from v1; +select coalesce(n * 1, null) from t1 group by coalesce(n * 1, null); +select coalesce(n * 1, null) from v1 group by coalesce(n * 1, null); +select coalesce(n * 1, null) from v1 group by 1; +select coalesce(n * 1, null) from v1 group by 1 having coalesce(n * 1, null) < 100; +select coalesce(n * 10, null) from v1 order by 1; +select coalesce(n * 10, null), coalesce(x * 10, null) from v1 order by 2 desc, 1 desc; +select coalesce(n * 10, null), coalesce(x * 10, null) from v1 order by 1 desc, 2 desc; + +-- test case +select case n * 1 when 1 then n * 1 else n + 0 end + from v1 group by case n * 1 when 1 then n * 1 else n + 0 end; +select case n * 1 when 1 then n * 1 else n + 0 end from v1 group by 1; +select case n * 1 when 1 then n * 1 else n + 0 end + from v1 group by 1 having case n * 1 when 1 then n * 1 else n + 0 end < 100; +select case n * 1 when 1 then n * 1 else n + 0 end from v1 order by 1 desc; + +-- test non-valid statements +select coalesce(n * 1, null) from v1 group by 1 having coalesce(n * 0, null) < 100; +select case n * 1 when 1 then n * 1 else n + 0 end + from v1 group by case n * 1 when 1 then n * 1 else n + 1 end; +select case n * 1 when 1 then n * 1 else n + 0 end + from v1 group by 1 having case n * 1 when 1 then n * 1 else n + 1 end < 100; + +set term ^ ; + +create procedure p1 returns (n integer) +as +begin + select coalesce(n * 1, null) from t1 group by coalesce(n * 1, null) into n; + suspend; +end^ + +set term ; ^ + +commit; +-- set blob all; +-- select rdb$procedure_blr from rdb$procedures where rdb$procedure_name = 'P1'; + +-- test coalesce in view condition +create view v2 as + select t1.n n, coalesce(n + 1, null) x1, coalesce(n + 2, null) x2 from t1 + where coalesce(0 + 0, null) = coalesce(0 + 0, null); + +select * from v2; + +-- test coalesce in view using distinct +create view v3 as + select distinct + t1.n n, + coalesce(n + 1, null) + coalesce(n + 11, null) x1, + coalesce(n + 2, null) + coalesce(n + 22, null) x2 + from t1; + +select * from v3; + +-- test coalesce with subselect with coalesce in view +create view v4 as + select + t1.n n, + coalesce((select coalesce(0 + 1, null) from rdb$database), null) x1, + coalesce((select coalesce(2 + 1, null) from rdb$database), null) x2 + from t1; + +select * from v4; + +-- test coalesce in view using union +create view v5 (n, x1, x2) as + select + t1.n n, + coalesce(n + 1, null) + coalesce(n + 11, null) x1, + coalesce(n + 2, null) + coalesce(n + 22, null) x2 + from t1 + union all + select + t1.n n, + coalesce(n + 1, null) + coalesce(n + 11, null) x1, + coalesce(n + 2, null) + coalesce(n + 22, null) x2 + from t1; + +select * from v5; + +-- test constraint +alter table t1 + add constraint t1_n check (coalesce(n + 0, null) < 10), + add constraint t1_cx check (coalesce(cx + 0, null) < 10); + +insert into t1 values (5, 5); +insert into t1 values (50, 5); +insert into t1 values (5, 50); + +-- test domain constraint +create domain dc1 as integer check (coalesce(value + 0, null) < 10); +create domain dc2 as integer check (coalesce(value + 0, null) < 10); + +alter table t1 + add dc1 dc1, + add dc2 dc2; + +insert into t1 (n, dc1) values (6, 6); +insert into t1 (n, dc2) values (7, 7); +insert into t1 (n, dc1) values (8, 10); +insert into t1 (n, dc2) values (8, 10); + +-- add bad computed expression with coalesce +alter table t1 + add bc computed by (coalesce(n / (n - 2), null)); + +select bc from t1 order by n; + +-- test parameters +set sqlda_display on; + +select coalesce(1 + cast(? as integer), 2 + cast(? as integer)) + from rdb$database + where coalesce(3 + cast(? as bigint), null) = 0; +""", + 'expected_stdout': """ + N X CN CX +============ ============ ===================== ===================== + 1 10 1 10 + 2 20 2 20 + 3 30 3 30 + + + GEN_ID +===================== + 3 + + + N X CN CX +============ ============ ============ ============ + 1 100 1 100 + 2 200 2 200 + 3 30 3 30 + + + GEN_ID +===================== + 3 + + + N X CN CX VCN +============ ============ ===================== ===================== ===================== + 1 100 1 100 1 + 2 200 2 200 2 + 3 30 3 30 3 + + + N X CN CX +============ ============ ============ ============ + 1 100 1 100 + 2 200 2 200 + 3 300 3 300 + 4 40 4 40 + + + N X CN CX VCN +============ ============ ===================== ===================== ===================== + 1 100 1 100 1 + 2 200 2 200 2 + 3 300 3 300 3 + 4 40 4 40 4 + 1008 88 1008 88 1008 + + + COALESCE +===================== + 1 + 2 + 3 + 4 + 1008 + + + COALESCE +===================== + 1 + 2 + 3 + 4 + 1008 + + + COALESCE +===================== + 1 + 2 + 3 + 4 + 1008 + + + COALESCE +===================== + 1 + 2 + 3 + 4 + 1008 + + + COALESCE +===================== + 1 + 2 + 3 + 4 + + + COALESCE +===================== + 10 + 20 + 30 + 40 + 10080 + + + COALESCE COALESCE +===================== ===================== + 30 3000 + 20 2000 + 10 1000 + 10080 880 + 40 400 + + + COALESCE COALESCE +===================== ===================== + 10080 880 + 40 400 + 30 3000 + 20 2000 + 10 1000 + + + CASE +===================== + 1 + 2 + 3 + 4 + 1008 + + + CASE +===================== + 1 + 2 + 3 + 4 + 1008 + + + CASE +===================== + 1 + 2 + 3 + 4 + + + CASE +===================== + 1008 + 4 + 3 + 2 + 1 + + + N X1 X2 +============ ===================== ===================== + 1 2 3 + 2 3 4 + 3 4 5 + 4 5 6 + 1008 1009 1010 + + + N X1 X2 +============ ===================== ===================== + 1 14 26 + 2 16 28 + 3 18 30 + 4 20 32 + 1008 2028 2040 + + + N X1 X2 +============ ===================== ===================== + 1 1 3 + 2 1 3 + 3 1 3 + 4 1 3 + 1008 1 3 + + + N X1 X2 +============ ===================== ===================== + 1 14 26 + 2 16 28 + 3 18 30 + 4 20 32 + 1008 2028 2040 + 1 14 26 + 2 16 28 + 3 18 30 + 4 20 32 + 1008 2028 2040 + + + BC +===================== + -1 + +INPUT SQLDA version: 1 sqln: 10 sqld: 3 +01: sqltype: 496 LONG sqlscale: 0 sqlsubtype: 0 sqllen: 4 + : name: (0) alias: (0) + : table: (0) owner: (0) +02: sqltype: 496 LONG sqlscale: 0 sqlsubtype: 0 sqllen: 4 + : name: (0) alias: (0) + : table: (0) owner: (0) +03: sqltype: 580 INT64 sqlscale: 0 sqlsubtype: 0 sqllen: 8 + : name: (0) alias: (0) + : table: (0) owner: (0) + +OUTPUT SQLDA version: 1 sqln: 20 sqld: 1 +01: sqltype: 580 INT64 sqlscale: 0 sqlsubtype: 0 sqllen: 8 + : name: (8)COALESCE alias: (8)COALESCE + : table: (0) owner: (0) + + COALESCE +===================== +""", + 'expected_stderr': """Statement failed, SQLSTATE = 42000 +Dynamic SQL Error +-SQL error code = -104 +-Invalid expression in the HAVING clause (neither an aggregate function nor a part of the GROUP BY clause) +Statement failed, SQLSTATE = 42000 +Dynamic SQL Error +-SQL error code = -104 +-Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause) +Statement failed, SQLSTATE = 42000 +Dynamic SQL Error +-SQL error code = -104 +-Invalid expression in the HAVING clause (neither an aggregate function nor a part of the GROUP BY clause) +Statement failed, SQLSTATE = 23000 +Operation violates CHECK constraint T1_N on view or table T1 +-At trigger 'CHECK_1' +Statement failed, SQLSTATE = 23000 +Operation violates CHECK constraint T1_CX on view or table T1 +-At trigger 'CHECK_3' +Statement failed, SQLSTATE = 23000 +validation error for column "T1"."DC1", value "10" +Statement failed, SQLSTATE = 23000 +validation error for column "T1"."DC2", value "10" +Statement failed, SQLSTATE = 22012 +arithmetic exception, numeric overflow, or string truncation +-Integer divide by zero. The code attempted to divide an integer value by an integer divisor of zero. +Statement failed, SQLSTATE = 07002 +Dynamic SQL Error +-SQL error code = -804 +-SQLDA missing or incorrect version, or incorrect number/type of variables +""" } ] } Modified: qa/fbt-repository/trunk/tests/bugs/core_1462.fbt =================================================================== --- qa/fbt-repository/trunk/tests/bugs/core_1462.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/bugs/core_1462.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -1365,6 +1365,278 @@ Dynamic SQL Error -Too many Contexts of Relation/Procedure/Views. Maximum allowed is 255 """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """create table test (i integer); +create index test_i on test(i); +commit; +""", + 'test_type': 'ISQL', + 'test_script': """select test.i from test + inner join test as t1 on t1.i = test.i + inner join test as t2 on t2.i = test.i + inner join test as t3 on t3.i = test.i + inner join test as t4 on t4.i = test.i + inner join test as t5 on t5.i = test.i + inner join test as t6 on t6.i = test.i + inner join test as t7 on t7.i = test.i + inner join test as t8 on t8.i = test.i + inner join test as t9 on t9.i = test.i + inner join test as t10 on t10.i = test.i + inner join test as t11 on t11.i = test.i + inner join test as t12 on t12.i = test.i + inner join test as t13 on t13.i = test.i + inner join test as t14 on t14.i = test.i + inner join test as t15 on t15.i = test.i + inner join test as t16 on t16.i = test.i + inner join test as t17 on t17.i = test.i + inner join test as t18 on t18.i = test.i + inner join test as t19 on t19.i = test.i + inner join test as t20 on t20.i = test.i + inner join test as t21 on t21.i = test.i + inner join test as t22 on t22.i = test.i + inner join test as t23 on t23.i = test.i + inner join test as t24 on t24.i = test.i + inner join test as t25 on t25.i = test.i + inner join test as t26 on t26.i = test.i + inner join test as t27 on t27.i = test.i + inner join test as t28 on t28.i = test.i + inner join test as t29 on t29.i = test.i + inner join test as t30 on t30.i = test.i + inner join test as t31 on t31.i = test.i + inner join test as t32 on t32.i = test.i + inner join test as t33 on t33.i = test.i + inner join test as t34 on t34.i = test.i + inner join test as t35 on t35.i = test.i + inner join test as t36 on t36.i = test.i + inner join test as t37 on t37.i = test.i + inner join test as t38 on t38.i = test.i + inner join test as t39 on t39.i = test.i + inner join test as t40 on t40.i = test.i + inner join test as t41 on t41.i = test.i + inner join test as t42 on t42.i = test.i + inner join test as t43 on t43.i = test.i + inner join test as t44 on t44.i = test.i + inner join test as t45 on t45.i = test.i + inner join test as t46 on t46.i = test.i + inner join test as t47 on t47.i = test.i + inner join test as t48 on t48.i = test.i + inner join test as t49 on t49.i = test.i + inner join test as t50 on t50.i = test.i + inner join test as t51 on t51.i = test.i + inner join test as t52 on t52.i = test.i + inner join test as t53 on t53.i = test.i + inner join test as t54 on t54.i = test.i + inner join test as t55 on t55.i = test.i + inner join test as t56 on t56.i = test.i + inner join test as t57 on t57.i = test.i + inner join test as t58 on t58.i = test.i + inner join test as t59 on t59.i = test.i + inner join test as t60 on t60.i = test.i + inner join test as t61 on t61.i = test.i + inner join test as t62 on t62.i = test.i + inner join test as t63 on t63.i = test.i + inner join test as t64 on t64.i = test.i + inner join test as t65 on t65.i = test.i + inner join test as t66 on t66.i = test.i + inner join test as t67 on t67.i = test.i + inner join test as t68 on t68.i = test.i + inner join test as t69 on t69.i = test.i + inner join test as t70 on t70.i = test.i + inner join test as t71 on t71.i = test.i + inner join test as t72 on t72.i = test.i + inner join test as t73 on t73.i = test.i + inner join test as t74 on t74.i = test.i + inner join test as t75 on t75.i = test.i + inner join test as t76 on t76.i = test.i + inner join test as t77 on t77.i = test.i + inner join test as t78 on t78.i = test.i + inner join test as t79 on t79.i = test.i + inner join test as t80 on t80.i = test.i + inner join test as t81 on t81.i = test.i + inner join test as t82 on t82.i = test.i + inner join test as t83 on t83.i = test.i + inner join test as t84 on t84.i = test.i + inner join test as t85 on t85.i = test.i + inner join test as t86 on t86.i = test.i + inner join test as t87 on t87.i = test.i + inner join test as t88 on t88.i = test.i + inner join test as t89 on t89.i = test.i + inner join test as t90 on t90.i = test.i + inner join test as t91 on t91.i = test.i + inner join test as t92 on t92.i = test.i + inner join test as t93 on t93.i = test.i + inner join test as t94 on t94.i = test.i + inner join test as t95 on t95.i = test.i + inner join test as t96 on t96.i = test.i + inner join test as t97 on t97.i = test.i + inner join test as t98 on t98.i = test.i + inner join test as t99 on t99.i = test.i + inner join test as t100 on t100.i = test.i + inner join test as t101 on t101.i = test.i + inner join test as t102 on t102.i = test.i + inner join test as t103 on t103.i = test.i + inner join test as t104 on t104.i = test.i + inner join test as t105 on t105.i = test.i + inner join test as t106 on t106.i = test.i + inner join test as t107 on t107.i = test.i + inner join test as t108 on t108.i = test.i + inner join test as t109 on t109.i = test.i + inner join test as t110 on t110.i = test.i + inner join test as t111 on t111.i = test.i + inner join test as t112 on t112.i = test.i + inner join test as t113 on t113.i = test.i + inner join test as t114 on t114.i = test.i + inner join test as t115 on t115.i = test.i + inner join test as t116 on t116.i = test.i + inner join test as t117 on t117.i = test.i + inner join test as t118 on t118.i = test.i + inner join test as t119 on t119.i = test.i + inner join test as t120 on t120.i = test.i + inner join test as t121 on t121.i = test.i + inner join test as t122 on t122.i = test.i + inner join test as t123 on t123.i = test.i + inner join test as t124 on t124.i = test.i + inner join test as t125 on t125.i = test.i + inner join test as t126 on t126.i = test.i + inner join test as t127 on t127.i = test.i + inner join test as t128 on t128.i = test.i + inner join test as t129 on t129.i = test.i + inner join test as t130 on t130.i = test.i + inner join test as t131 on t131.i = test.i + inner join test as t132 on t132.i = test.i + inner join test as t133 on t133.i = test.i + inner join test as t134 on t134.i = test.i + inner join test as t135 on t135.i = test.i + inner join test as t136 on t136.i = test.i + inner join test as t137 on t137.i = test.i + inner join test as t138 on t138.i = test.i + inner join test as t139 on t139.i = test.i + inner join test as t140 on t140.i = test.i + inner join test as t141 on t141.i = test.i + inner join test as t142 on t142.i = test.i + inner join test as t143 on t143.i = test.i + inner join test as t144 on t144.i = test.i + inner join test as t145 on t145.i = test.i + inner join test as t146 on t146.i = test.i + inner join test as t147 on t147.i = test.i + inner join test as t148 on t148.i = test.i + inner join test as t149 on t149.i = test.i + inner join test as t150 on t150.i = test.i + inner join test as t151 on t151.i = test.i + inner join test as t152 on t152.i = test.i + inner join test as t153 on t153.i = test.i + inner join test as t154 on t154.i = test.i + inner join test as t155 on t155.i = test.i + inner join test as t156 on t156.i = test.i + inner join test as t157 on t157.i = test.i + inner join test as t158 on t158.i = test.i + inner join test as t159 on t159.i = test.i + inner join test as t160 on t160.i = test.i + inner join test as t161 on t161.i = test.i + inner join test as t162 on t162.i = test.i + inner join test as t163 on t163.i = test.i + inner join test as t164 on t164.i = test.i + inner join test as t165 on t165.i = test.i + inner join test as t166 on t166.i = test.i + inner join test as t167 on t167.i = test.i + inner join test as t168 on t168.i = test.i + inner join test as t169 on t169.i = test.i + inner join test as t170 on t170.i = test.i + inner join test as t171 on t171.i = test.i + inner join test as t172 on t172.i = test.i + inner join test as t173 on t173.i = test.i + inner join test as t174 on t174.i = test.i + inner join test as t175 on t175.i = test.i + inner join test as t176 on t176.i = test.i + inner join test as t177 on t177.i = test.i + inner join test as t178 on t178.i = test.i + inner join test as t179 on t179.i = test.i + inner join test as t180 on t180.i = test.i + inner join test as t181 on t181.i = test.i + inner join test as t182 on t182.i = test.i + inner join test as t183 on t183.i = test.i + inner join test as t184 on t184.i = test.i + inner join test as t185 on t185.i = test.i + inner join test as t186 on t186.i = test.i + inner join test as t187 on t187.i = test.i + inner join test as t188 on t188.i = test.i + inner join test as t189 on t189.i = test.i + inner join test as t190 on t190.i = test.i + inner join test as t191 on t191.i = test.i + inner join test as t192 on t192.i = test.i + inner join test as t193 on t193.i = test.i + inner join test as t194 on t194.i = test.i + inner join test as t195 on t195.i = test.i + inner join test as t196 on t196.i = test.i + inner join test as t197 on t197.i = test.i + inner join test as t198 on t198.i = test.i + inner join test as t199 on t199.i = test.i + inner join test as t200 on t200.i = test.i + inner join test as t201 on t201.i = test.i + inner join test as t202 on t202.i = test.i + inner join test as t203 on t203.i = test.i + inner join test as t204 on t204.i = test.i + inner join test as t205 on t205.i = test.i + inner join test as t206 on t206.i = test.i + inner join test as t207 on t207.i = test.i + inner join test as t208 on t208.i = test.i + inner join test as t209 on t209.i = test.i + inner join test as t210 on t210.i = test.i + inner join test as t211 on t211.i = test.i + inner join test as t212 on t212.i = test.i + inner join test as t213 on t213.i = test.i + inner join test as t214 on t214.i = test.i + inner join test as t215 on t215.i = test.i + inner join test as t216 on t216.i = test.i + inner join test as t217 on t217.i = test.i + inner join test as t218 on t218.i = test.i + inner join test as t219 on t219.i = test.i + inner join test as t220 on t220.i = test.i + inner join test as t221 on t221.i = test.i + inner join test as t222 on t222.i = test.i + inner join test as t223 on t223.i = test.i + inner join test as t224 on t224.i = test.i + inner join test as t225 on t225.i = test.i + inner join test as t226 on t226.i = test.i + inner join test as t227 on t227.i = test.i + inner join test as t228 on t228.i = test.i + inner join test as t229 on t229.i = test.i + inner join test as t230 on t230.i = test.i + inner join test as t231 on t231.i = test.i + inner join test as t232 on t232.i = test.i + inner join test as t233 on t233.i = test.i + inner join test as t234 on t234.i = test.i + inner join test as t235 on t235.i = test.i + inner join test as t236 on t236.i = test.i + inner join test as t237 on t237.i = test.i + inner join test as t238 on t238.i = test.i + inner join test as t239 on t239.i = test.i + inner join test as t240 on t240.i = test.i + inner join test as t241 on t241.i = test.i + inner join test as t242 on t242.i = test.i + inner join test as t243 on t243.i = test.i + inner join test as t244 on t244.i = test.i + inner join test as t245 on t245.i = test.i + inner join test as t246 on t246.i = test.i + inner join test as t247 on t247.i = test.i + inner join test as t248 on t248.i = test.i + inner join test as t249 on t249.i = test.i + inner join test as t250 on t250.i = test.i + inner join test as t251 on t251.i = test.i + inner join test as t252 on t252.i = test.i + inner join test as t253 on t253.i = test.i + inner join test as t254 on t254.i = test.i + inner join test as t255 on t255.i = test.i + inner join test as t256 on t256.i = test.i + ; +""", + 'expected_stderr': """Statement failed, SQLSTATE = 54001 +Dynamic SQL Error +-Too many Contexts of Relation/Procedure/Views. Maximum allowed is 255 +""" } ] } Modified: qa/fbt-repository/trunk/tests/bugs/core_1559.fbt =================================================================== --- qa/fbt-repository/trunk/tests/bugs/core_1559.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/bugs/core_1559.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -4,6 +4,7 @@ 'tracker_id': 'CORE-1559', 'title': "Dropping NOT NULL contranint doesn'have the desired effect", 'description': '', +'min_versions': None, 'versions': [ { 'firebird_version': '2.5.0', @@ -52,6 +53,32 @@ 'expected_stderr': """Statement failed, SQLCODE = -625 validation error for column N, value "*** null ***" """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'test_type': 'ISQL', + 'test_script': """create table t (n integer constraint c not null); +COMMIT; +insert into t values (null); +COMMIT; +alter table t drop constraint c; +COMMIT; +insert into t values (null); +COMMIT; +SELECT * FROM t; +""", + 'expected_stdout': """Database: localhost:C:\Users\win7\Firebird_tests\fbt-repository\tmp\bugs.core_1559.fdb, User: SYSDBA +SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> + N +============ + <null> + +SQL>""", + 'expected_stderr': """Statement failed, SQLSTATE = 23000 +validation error for column "T"."N", value "*** null ***" +""" + } ] } Modified: qa/fbt-repository/trunk/tests/functional/domain/create_41.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/domain/create_41.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/domain/create_41.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -42,7 +42,7 @@ unsuccessful metadata update -CREATE DOMAIN TEST failed -violation of PRIMARY or UNIQUE KEY constraint "RDB$INDEX_2" on table "RDB$FIELDS" - +-Problematic key value is ("RDB$FIELD_NAME" = 'TEST') """ }, { @@ -57,6 +57,19 @@ -attempt to store duplicate value (visible to active transactions) in unique index "RDB$INDEX_2" -Problematic key value is ("RDB$FIELD_NAME" = 'TEST') """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': 'CREATE DOMAIN test AS INTEGER;', + 'test_type': 'ISQL', + 'test_script': 'CREATE DOMAIN test AS VARCHAR(32);', + 'expected_stderr': """Statement failed, SQLSTATE = 42000 +unsuccessful metadata update +-STORE RDB$FIELDS failed +-attempt to store duplicate value (visible to active transactions) in unique index "RDB$INDEX_2" +-Problematic key value is ("RDB$FIELD_NAME" = 'TEST') +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_02.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_02.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_02.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -116,6 +116,60 @@ - violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" - Foreign key reference target does not exist """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID INTEGER PRIMARY KEY, + INT_F INTEGER +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY INTEGER +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY) REFERENCES MASTER_TABLE (ID); +COMMIT; +INSERT INTO MASTER_TABLE (ID, INT_F) VALUES (1, 10); +commit;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) + +db_conn.begin(tpb=TPB_master) +c = db_conn.cursor() +c.execute("uPDATE MASTER_TABLE SET ID = 2 WHERE ID=1") + +#Create second connection - update detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) + +try: + con_detail.begin(tpb=TPB_detail) + c = con_detail.cursor() + c.execute("INSERT INTO DETAIL_TABLE (ID, FKEY) VALUES (1,1)") + con_detail.commit() +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key reference target does not exist +- Problematic key value is ("FKEY" = 1) +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_03.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_03.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_03.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -128,6 +128,64 @@ - violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" - Foreign key reference target does not exist """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID INTEGER PRIMARY KEY, + INT_F INTEGER +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY INTEGER +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY) REFERENCES MASTER_TABLE (ID); +COMMIT; +INSERT INTO MASTER_TABLE (ID, INT_F) VALUES (1, 10); +commit;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) + + +db_conn.begin(tpb=TPB_master) +cm_1 = db_conn.cursor() +cm_1.execute('UPDATE MASTER_TABLE SET INT_F=2') +db_conn.savepoint('A') +cm_1.execute('UPDATE MASTER_TABLE SET ID=2 WHERE ID=1') +db_conn.rollback(savepoint='A') + +#Create second connection - update detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) + +try: + con_detail.begin(tpb=TPB_detail) + cd = con_detail.cursor() + cd.execute("INSERT INTO DETAIL_TABLE (ID, FKEY) VALUES (1,1)") + con_detail.commit() +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key reference target does not exist +- Problematic key value is ("FKEY" = 1) +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_04.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_04.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_04.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -128,6 +128,64 @@ - violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" - Foreign key reference target does not exist """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID INTEGER PRIMARY KEY, + INT_F INTEGER +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY INTEGER +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY) REFERENCES MASTER_TABLE (ID); +COMMIT; +INSERT INTO MASTER_TABLE (ID, INT_F) VALUES (1, 10); +commit;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) + + +db_conn.begin(tpb=TPB_master) +cm_1 = db_conn.cursor() +cm_1.execute('UPDATE MASTER_TABLE SET ID=2 WHERE ID=1') +db_conn.savepoint('A') +cm_1.execute('UPDATE MASTER_TABLE SET INT_F=2 ') +db_conn.rollback(savepoint='A') + +#Create second connection for change detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) + +try: + con_detail.begin(tpb=TPB_detail) + cd = con_detail.cursor() + cd.execute("INSERT INTO DETAIL_TABLE (ID, FKEY) VALUES (1,1)") + con_detail.commit() +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key reference target does not exist +- Problematic key value is ("FKEY" = 1) +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_08.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_08.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_08.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -121,6 +121,62 @@ - violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" - Foreign key reference target does not exist """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID_1 INTEGER NOT NULL, + ID_2 VARCHAR(20) NOT NULL, + INT_F INTEGER, + PRIMARY KEY (ID_1, ID_2) +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY_1 INTEGER, + FKEY_2 VARCHAR(20) +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY_1, FKEY_2) REFERENCES MASTER_TABLE (ID_1, ID_2); +COMMIT; +INSERT INTO MASTER_TABLE (ID_1, ID_2, INT_F) VALUES (1, 'one', 10); +COMMIT;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +db_conn.begin(tpb=TPB_master) +cm_1 = db_conn.cursor() +cm_1.execute('UPDATE MASTER_TABLE SET ID_1=2 WHERE ID_1=1') + +#Create second connection for change detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) + +try: + con_detail.begin(tpb=TPB_detail) + cd = con_detail.cursor() + cd.execute("INSERT INTO DETAIL_TABLE (ID, FKEY_1, FKEY_2) VALUES (1, 1, 'one')") + con_detail.commit() +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key reference target does not exist +- Problematic key value is ("FKEY_1" = 1, "FKEY_2" = 'one') +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_09.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_09.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_09.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -123,6 +123,63 @@ - violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" - Foreign key reference target does not exist """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID_1 INTEGER NOT NULL, + ID_2 VARCHAR(20) NOT NULL, + INT_F INTEGER, + PRIMARY KEY (ID_1, ID_2) +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY_1 INTEGER, + FKEY_2 VARCHAR(20) +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY_1, FKEY_2) REFERENCES MASTER_TABLE (ID_1, ID_2); +COMMIT; +INSERT INTO MASTER_TABLE (ID_1, ID_2, INT_F) VALUES (1, 'one', 10); +COMMIT;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +db_conn.begin(tpb=TPB_master) +cm_1 = db_conn.cursor() +cm_1.execute("UPDATE MASTER_TABLE SET ID_1=2 WHERE ID_1=1") +cm_1.execute("UPDATE MASTER_TABLE SET ID_2='two' WHERE ID_2='one'") + +#Create second connection for change detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) + +try: + con_detail.begin(tpb=TPB_detail) + cd = con_detail.cursor() + cd.execute("INSERT INTO DETAIL_TABLE (ID, FKEY_1, FKEY_2) VALUES (1, 1, 'one')") + con_detail.commit() +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key reference target does not exist +- Problematic key value is ("FKEY_1" = 1, "FKEY_2" = 'one') +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_15.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_15.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_15.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -112,6 +112,58 @@ - violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" - Foreign key reference target does not exist """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID INTEGER PRIMARY KEY, + INT_F INTEGER +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY INTEGER +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY) REFERENCES MASTER_TABLE (ID); +COMMIT;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +db_conn.begin(tpb=TPB_master) +cm_1 = db_conn.cursor() +cm_1.execute('INSERT INTO MASTER_TABLE (ID, INT_F) VALUES (2, 20)') + +#Create second connection for change detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) + +try: + con_detail.begin(tpb=TPB_detail) + cd = con_detail.cursor() + cd.execute("INSERT INTO DETAIL_TABLE (ID, FKEY) VALUES (1,2)") + con_detail.commit() +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -901 +- lock conflict on no wait transaction +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key reference target does not exist +- Problematic key value is ("FKEY" = 2) +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_17.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_17.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_17.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -67,6 +67,65 @@ - Foreign key references are present for the record """, 'substitutions': [('lock.*','')] +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID INTEGER PRIMARY KEY, + INT_F INTEGER +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY INTEGER +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY) REFERENCES MASTER_TABLE (ID); +COMMIT; +INSERT INTO MASTER_TABLE (ID, INT_F) VALUES (1, 10); +commit;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) + +db_conn.begin(tpb=TPB_master) +c = db_conn.cursor() +c.execute("update master_table set int_f = 10 WHERE ID=1") + +#Create second connection for change detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) +try: + con_detail.begin(tpb=TPB_detail) + c = con_detail.cursor() + c.execute("INSERT INTO DETAIL_TABLE (ID, FKEY) VALUES (1,1)") +except Exception, e: + print (e[1]) + +try: + c = db_conn.cursor() + c.execute("update master_table set ID=10 WHERE ID=1") +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key references are present for the record +- Problematic key value is ("ID" = 1) +""", + 'substitutions': [('lock.*','')] } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_18.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_18.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/primary/insert_pk_18.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -68,6 +68,65 @@ - violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" - Foreign key references are present for the record """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID INTEGER PRIMARY KEY, + INT_F INTEGER +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY INTEGER +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY) REFERENCES MASTER_TABLE (ID); +COMMIT; +INSERT INTO MASTER_TABLE (ID, INT_F) VALUES (1, 10); +commit;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) + +db_conn.begin(tpb=TPB_master) +c = db_conn.cursor() +c.execute("update master_table set int_f = 10 WHERE ID=1") + +#Create second connection for change detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) +try: + con_detail.begin(tpb=TPB_detail) + c = con_detail.cursor() + c.execute("INSERT INTO DETAIL_TABLE (ID, FKEY) VALUES (1,1)") + con_detail.commit() +except Exception, e: + print (e[1]) + +try: + c = db_conn.cursor() + c.execute("update master_table set ID=10 WHERE ID=1") +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key references are present for the record +- Problematic key value is ("ID" = 1) +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_02.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_02.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_02.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -118,6 +118,61 @@ - violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" - Foreign key reference target does not exist """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID INTEGER PRIMARY KEY, + UF INTEGER UNIQUE, + INT_F INTEGER +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY INTEGER +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY) REFERENCES MASTER_TABLE (UF); +COMMIT; +INSERT INTO MASTER_TABLE (ID, UF, INT_F) VALUES (1, 1, 10); +commit;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) + +db_conn.begin(tpb=TPB_master) +c = db_conn.cursor() +c.execute("uPDATE MASTER_TABLE SET UF=2 WHERE ID=1") + +#Create second connection - update detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) + +try: + con_detail.begin(tpb=TPB_detail) + c = con_detail.cursor() + c.execute("INSERT INTO DETAIL_TABLE (ID, FKEY) VALUES (1,2)") + con_detail.commit() +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key reference target does not exist +- Problematic key value is ("FKEY" = 2) +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_04.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_04.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_04.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -131,6 +131,65 @@ - violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" - Foreign key reference target does not exist """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID INTEGER PRIMARY KEY, + UF INTEGER UNIQUE, + INT_F INTEGER +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY INTEGER +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY) REFERENCES MASTER_TABLE (UF); +COMMIT; +INSERT INTO MASTER_TABLE (ID, UF, INT_F) VALUES (1, 1, 10); +commit;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) + + +db_conn.begin(tpb=TPB_master) +cm_1 = db_conn.cursor() +cm_1.execute('UPDATE MASTER_TABLE SET UF=2 WHERE ID=1') +db_conn.savepoint('A') +cm_1.execute('UPDATE MASTER_TABLE SET INT_F=2 ') +db_conn.rollback(savepoint='A') + +#Create second connection for change detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) + +try: + con_detail.begin(tpb=TPB_detail) + cd = con_detail.cursor() + cd.execute("INSERT INTO DETAIL_TABLE (ID, FKEY) VALUES (1,2)") + con_detail.commit() +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key reference target does not exist +- Problematic key value is ("FKEY" = 2) +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_12.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_12.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_12.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -71,6 +71,67 @@ - Foreign key references are present for the record """, 'substitutions': [('lock.*','')] +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID INTEGER PRIMARY KEY, + UF INTEGER UNIQUE, + INT_F INTEGER +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY INTEGER +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY) REFERENCES MASTER_TABLE (UF); +COMMIT; +INSERT INTO MASTER_TABLE (ID, UF, INT_F) VALUES (1, 1, 10); +commit;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) + +db_conn.begin(tpb=TPB_master) +c = db_conn.cursor() +c.execute("update master_table set int_f = 10 WHERE ID=1") + +#Create second connection for change detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) + +try: + con_detail.begin(tpb=TPB_detail) + c = con_detail.cursor() + c.execute("INSERT INTO DETAIL_TABLE (ID, FKEY) VALUES (1,1)") +except Exception, e: + print (e[1]) + +try: + c = db_conn.cursor() + c.execute("update master_table set UF=10 WHERE ID=1") +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key references are present for the record +- Problematic key value is ("UF" = 1) +""", + 'substitutions': [('lock.*','')] } ] } Modified: qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_13.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_13.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/fkey/unique/insert_13.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -72,6 +72,67 @@ - violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" - Foreign key references are present for the record """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE MASTER_TABLE ( + ID INTEGER PRIMARY KEY, + UF INTEGER UNIQUE, + INT_F INTEGER +); + +CREATE TABLE DETAIL_TABLE ( + ID INTEGER PRIMARY KEY, + FKEY INTEGER +); + +ALTER TABLE DETAIL_TABLE ADD CONSTRAINT FK_DETAIL_TABLE FOREIGN KEY (FKEY) REFERENCES MASTER_TABLE (UF); +COMMIT; +INSERT INTO MASTER_TABLE (ID, UF, INT_F) VALUES (1, 1, 10); +commit;""", + 'test_type': 'Python', + 'test_script': """TPB_master = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) +TPB_detail = ( + chr(kdb.isc_tpb_write) + + chr(kdb.isc_tpb_read_committed) + chr(kdb.isc_tpb_rec_version) + + chr(kdb.isc_tpb_nowait) + ) + +db_conn.begin(tpb=TPB_master) +c = db_conn.cursor() +c.execute("update master_table set int_f = 10 WHERE ID=1") + +#Create second connection for change detail table +con_detail = kdb.connect( + dsn=dsn.encode(), + user=user_name.encode(), + password=user_password.encode() +) + +try: + con_detail.begin(tpb=TPB_detail) + c = con_detail.cursor() + c.execute("INSERT INTO DETAIL_TABLE (ID, FKEY) VALUES (1,1)") + con_detail.commit() +except Exception, e: + print (e[1]) + +try: + c = db_conn.cursor() + c.execute("update master_table set UF=10 WHERE ID=1") +except Exception, e: + print (e[0])""", + 'expected_stdout': """Error while executing SQL statement: +- SQLCODE: -530 +- violation of FOREIGN KEY constraint "FK_DETAIL_TABLE" on table "DETAIL_TABLE" +- Foreign key references are present for the record +- Problematic key value is ("UF" = 1) +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/index/create_11.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/index/create_11.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/index/create_11.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -71,6 +71,26 @@ attempt to store duplicate value (visible to active transactions) in unique index "TEST" -Problematic key value is ("A" = 0) """ +}, +{ + 'firebird_version': '2.5.3', + 'platform': 'All', + 'init_script': """CREATE TABLE t( a INTEGER); +commit; +INSERT INTO t VALUES(0); +INSERT INTO t VALUES(0); +INSERT INTO t VALUES(1); +INSERT INTO t VALUES(2); +INSERT INTO t VALUES(3); +INSERT INTO t VALUES(4); +COMMIT; +""", + 'test_type': 'ISQL', + 'test_script': 'CREATE UNIQUE INDEX test ON t(a);', + 'expected_stderr': """Statement failed, SQLSTATE = 23000 +attempt to store duplicate value (visible to active transactions) in unique index "TEST" +-Problematic key value is ("A" = 0) +""" } ] } Modified: qa/fbt-repository/trunk/tests/functional/table/create_06.fbt =================================================================== --- qa/fbt-repository/trunk/tests/functional/table/create_06.fbt 2014-07-28 11:03:49 UTC (rev 59920) +++ qa/fbt-repository/trunk/tests/functional/table/create_06.fbt 2014-07-28 11:54:55 UTC (rev 59921) @@ -58,7 +58,7 @@ unsuccessful metadata update -CREATE TABLE TEST failed -violation of PRIMARY or UNIQUE KEY constraint "RDB$INDEX_15" on table "RDB$RELATION_FIELDS" - +-Problematic key value is ("RDB$FIELD_NAME" = 'C1', "RDB$RELATION_NAME" = 'TEST') """ }, { @@ -77,6 +77,23 @@ -attempt to store duplicate value (visible to active transactions) in unique index... [truncated message content] |