~ubuntu-branches/ubuntu/hardy/mysql-dfsg-5.0/hardy-updates

« back to all changes in this revision

Viewing changes to mysql-test/t/sp.test

  • Committer: Bazaar Package Importer
  • Author(s): sean finney
  • Date: 2007-05-13 12:32:45 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20070513123245-8c3l187dk34cz2ar
Tags: 5.0.41-2
the previous "translation changes" inadvertently introduced unrelated
changes in the package control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6592
6592
drop procedure proc_bug19733|
6593
6593
drop table t3|
6594
6594
 
 
6595
 
 
6596
#
 
6597
# BUG#20492: Subsequent calls to stored procedure yeild incorrect
 
6598
# result if join is used 
 
6599
#
 
6600
# Optimized ON expression in join wasn't properly saved for reuse.
 
6601
#
 
6602
--disable_warnings
 
6603
DROP PROCEDURE IF EXISTS p1|
 
6604
DROP VIEW IF EXISTS v1, v2|
 
6605
DROP TABLE IF EXISTS t3, t4|
 
6606
--enable_warnings
 
6607
 
 
6608
CREATE TABLE t3 (t3_id INT)|
 
6609
 
 
6610
INSERT INTO t3 VALUES (0)|
 
6611
INSERT INTO t3 VALUES (1)|
 
6612
 
 
6613
CREATE TABLE t4 (t4_id INT)|
 
6614
 
 
6615
INSERT INTO t4 VALUES (2)|
 
6616
 
 
6617
CREATE VIEW v1 AS
 
6618
SELECT t3.t3_id, t4.t4_id
 
6619
FROM t3 JOIN t4 ON t3.t3_id = 0|
 
6620
 
 
6621
CREATE VIEW v2 AS
 
6622
SELECT t3.t3_id AS t3_id_1, v1.t3_id AS t3_id_2, v1.t4_id
 
6623
FROM t3 LEFT JOIN v1 ON t3.t3_id = 0|
 
6624
 
 
6625
CREATE PROCEDURE p1() SELECT * FROM v2|
 
6626
 
 
6627
# Results should not differ.
 
6628
CALL p1()|
 
6629
CALL p1()|
 
6630
 
 
6631
DROP PROCEDURE p1|
 
6632
DROP VIEW v1, v2|
 
6633
DROP TABLE t3, t4|
 
6634
 
 
6635
 
6595
6636
--echo End of 5.0 tests
6596
6637
 
6597
6638
 
6739
6780
drop function func_8407_b|
6740
6781
 
6741
6782
#
 
6783
# Bug#26503 (Illegal SQL exception handler code causes the server to crash)
 
6784
#
 
6785
 
 
6786
--disable_warnings
 
6787
drop table if exists table_26503|
 
6788
drop procedure if exists proc_26503_ok_1|
 
6789
drop procedure if exists proc_26503_ok_2|
 
6790
drop procedure if exists proc_26503_ok_3|
 
6791
drop procedure if exists proc_26503_ok_4|
 
6792
--enable_warnings
 
6793
 
 
6794
create table table_26503(a int unique)|
 
6795
 
 
6796
create procedure proc_26503_ok_1(v int)
 
6797
begin
 
6798
  declare i int default 5;
 
6799
 
 
6800
  declare continue handler for sqlexception
 
6801
  begin
 
6802
    select 'caught something';
 
6803
    retry:
 
6804
    while i > 0 do
 
6805
      begin
 
6806
        set i = i - 1;
 
6807
        select 'looping', i;
 
6808
        iterate retry;
 
6809
        select 'dead code';
 
6810
      end;
 
6811
    end while retry;
 
6812
    select 'leaving handler';
 
6813
  end;
 
6814
 
 
6815
  select 'do something';
 
6816
  insert into table_26503 values (v);
 
6817
  select 'do something again';
 
6818
  insert into table_26503 values (v);
 
6819
end|
 
6820
 
 
6821
create procedure proc_26503_ok_2(v int)
 
6822
begin
 
6823
  declare i int default 5;
 
6824
 
 
6825
  declare continue handler for sqlexception
 
6826
  begin
 
6827
    select 'caught something';
 
6828
    retry:
 
6829
    while i > 0 do
 
6830
      begin
 
6831
        set i = i - 1;
 
6832
        select 'looping', i;
 
6833
        leave retry;
 
6834
        select 'dead code';
 
6835
      end;
 
6836
    end while;
 
6837
    select 'leaving handler';
 
6838
  end;
 
6839
 
 
6840
  select 'do something';
 
6841
  insert into table_26503 values (v);
 
6842
  select 'do something again';
 
6843
  insert into table_26503 values (v);
 
6844
end|
 
6845
 
 
6846
## The outer retry label should not prevent using the inner label.
 
6847
 
 
6848
create procedure proc_26503_ok_3(v int)
 
6849
begin
 
6850
  declare i int default 5;
 
6851
 
 
6852
retry:
 
6853
  begin
 
6854
    declare continue handler for sqlexception
 
6855
    begin
 
6856
      select 'caught something';
 
6857
      retry:
 
6858
      while i > 0 do
 
6859
        begin
 
6860
          set i = i - 1;
 
6861
          select 'looping', i;
 
6862
          iterate retry;
 
6863
          select 'dead code';
 
6864
        end;
 
6865
      end while retry;
 
6866
      select 'leaving handler';
 
6867
    end;
 
6868
 
 
6869
    select 'do something';
 
6870
    insert into table_26503 values (v);
 
6871
    select 'do something again';
 
6872
    insert into table_26503 values (v);
 
6873
  end;
 
6874
end|
 
6875
 
 
6876
## The outer retry label should not prevent using the inner label.
 
6877
 
 
6878
create procedure proc_26503_ok_4(v int)
 
6879
begin
 
6880
  declare i int default 5;
 
6881
 
 
6882
retry:
 
6883
  begin
 
6884
    declare continue handler for sqlexception
 
6885
    begin
 
6886
      select 'caught something';
 
6887
      retry:
 
6888
      while i > 0 do
 
6889
        begin
 
6890
          set i = i - 1;
 
6891
          select 'looping', i;
 
6892
          leave retry;
 
6893
          select 'dead code';
 
6894
        end;
 
6895
      end while;
 
6896
      select 'leaving handler';
 
6897
    end;
 
6898
 
 
6899
    select 'do something';
 
6900
    insert into table_26503 values (v);
 
6901
    select 'do something again';
 
6902
    insert into table_26503 values (v);
 
6903
  end;
 
6904
end|
 
6905
 
 
6906
call proc_26503_ok_1(1)|
 
6907
call proc_26503_ok_2(2)|
 
6908
call proc_26503_ok_3(3)|
 
6909
call proc_26503_ok_4(4)|
 
6910
 
 
6911
drop table table_26503|
 
6912
drop procedure proc_26503_ok_1|
 
6913
drop procedure proc_26503_ok_2|
 
6914
drop procedure proc_26503_ok_3|
 
6915
drop procedure proc_26503_ok_4|
 
6916
 
 
6917
#
6742
6918
# Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
6743
6919
#            result.
6744
6920
#
6754
6930
DROP FUNCTION bug25373|
6755
6931
DROP TABLE t3|
6756
6932
#
6757
 
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
6758
 
#       at the end of the file!
6759
 
#
 
6933
# Bug#20777: Function w BIGINT UNSIGNED shows diff. behaviour --ps-protocol
 
6934
--disable_warnings
 
6935
drop function if exists bug20777|
 
6936
drop table if exists examplebug20777|
 
6937
--enabled_warnings
 
6938
create function bug20777(f1 bigint unsigned) returns bigint unsigned
 
6939
begin
 
6940
  set f1 = (f1 - 10); set f1 = (f1 + 10);
 
6941
return f1;
 
6942
end|
 
6943
delimiter ;|
 
6944
select bug20777(9223372036854775803) as '9223372036854775803   2**63-5';
 
6945
select bug20777(9223372036854775804) as '9223372036854775804   2**63-4';
 
6946
select bug20777(9223372036854775805) as '9223372036854775805   2**63-3';
 
6947
select bug20777(9223372036854775806) as '9223372036854775806   2**63-2';
 
6948
select bug20777(9223372036854775807) as '9223372036854775807   2**63-1';
 
6949
select bug20777(9223372036854775808) as '9223372036854775808   2**63+0';
 
6950
select bug20777(9223372036854775809) as '9223372036854775809   2**63+1';
 
6951
select bug20777(9223372036854775810) as '9223372036854775810   2**63+2';
 
6952
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
 
6953
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
 
6954
select bug20777(0) as 'lower bounds unsigned bigint';
 
6955
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
 
6956
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
 
6957
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
 
6958
 
 
6959
create table examplebug20777 as select 
 
6960
  0 as 'i',
 
6961
  bug20777(9223372036854775806) as '2**63-2',
 
6962
  bug20777(9223372036854775807) as '2**63-1',
 
6963
  bug20777(9223372036854775808) as '2**63',
 
6964
  bug20777(9223372036854775809) as '2**63+1',
 
6965
  bug20777(18446744073709551614) as '2**64-2',
 
6966
  bug20777(18446744073709551615) as '2**64-1', 
 
6967
  bug20777(18446744073709551616) as '2**64',
 
6968
  bug20777(0) as '0',
 
6969
  bug20777(-1) as '-1';
 
6970
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
 
6971
show create table examplebug20777;
 
6972
select * from examplebug20777 order by i;
 
6973
 
 
6974
drop table examplebug20777;
 
6975
select bug20777(18446744073709551613)+1;
 
6976
drop function bug20777;
 
6977
delimiter |;
 
6978
 
 
6979
###
 
6980
--echo End of 5.0 tests.
6760
6981
 
6761
6982
#
6762
6983
# BUG#NNNN: New bug synopsis
6765
6986
#drop procedure if exists bugNNNN|
6766
6987
#--enable_warnings
6767
6988
#create procedure bugNNNN...
6768
 
 
 
6989
#
6769
6990
# Add bugs above this line. Use existing tables t1 and t2 when
6770
 
# practical, or create table t3, t4 etc temporarily (and drop them).
 
6991
# practical, or create table t3,t4 etc temporarily (and drop them).
 
6992
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
 
6993
#       at the end of the file!
 
6994
#
 
6995
 
6771
6996
delimiter ;|
6772
6997
drop table t1,t2;
 
6998