@@ -2441,6 +2441,27 @@ var ProcedureCallTests = []ScriptTest{
2441
2441
},
2442
2442
},
2443
2443
},
2444
+ {
2445
+ Name : "creating invalid procedure doesn't error until it is called" ,
2446
+ Assertions : []ScriptTestAssertion {
2447
+ {
2448
+ Query : `CREATE PROCEDURE proc1 (OUT out_count INT) READS SQL DATA SELECT COUNT(*) FROM mytable WHERE i = 1 AND s = 'first row' AND func1(i);` ,
2449
+ Expected : []sql.Row {{types .NewOkResult (0 )}},
2450
+ },
2451
+ {
2452
+ Query : "CALL proc1(@out_count);" ,
2453
+ ExpectedErr : sql .ErrTableNotFound ,
2454
+ },
2455
+ {
2456
+ Query : "CREATE TABLE mytable (i int, s varchar(128));" ,
2457
+ Expected : []sql.Row {{types .NewOkResult (0 )}},
2458
+ },
2459
+ {
2460
+ Query : "CALL proc1(@out_count);" ,
2461
+ ExpectedErr : sql .ErrFunctionNotFound ,
2462
+ },
2463
+ },
2464
+ },
2444
2465
}
2445
2466
2446
2467
var ProcedureDropTests = []ScriptTest {
@@ -2787,25 +2808,12 @@ var ProcedureShowCreate = []ScriptTest{
2787
2808
}
2788
2809
2789
2810
var ProcedureCreateInSubroutineTests = []ScriptTest {
2790
- //TODO: Match MySQL behavior (https://github.com/dolthub/dolt/issues/8053)
2791
- {
2792
- Name : "procedure must not contain CREATE PROCEDURE" ,
2793
- Assertions : []ScriptTestAssertion {
2794
- {
2795
- Query : "CREATE PROCEDURE foo() CREATE PROCEDURE bar() SELECT 0;" ,
2796
- // MySQL output: "Can't create a PROCEDURE from within another stored routine",
2797
- ExpectedErrStr : "creating procedures in stored procedures is currently unsupported and will be added in a future release" ,
2798
- },
2799
- },
2800
- },
2801
2811
{
2802
2812
Name : "event must not contain CREATE PROCEDURE" ,
2803
2813
Assertions : []ScriptTestAssertion {
2804
2814
{
2805
- // Skipped because MySQL errors here but we don't.
2806
2815
Query : "CREATE EVENT foo ON SCHEDULE EVERY 1 YEAR DO CREATE PROCEDURE bar() SELECT 1;" ,
2807
- ExpectedErrStr : "Can't create a PROCEDURE from within another stored routine" ,
2808
- Skip : true ,
2816
+ ExpectedErrStr : "can't create a PROCEDURE from within another stored routine" ,
2809
2817
},
2810
2818
},
2811
2819
},
@@ -2828,11 +2836,11 @@ var ProcedureCreateInSubroutineTests = []ScriptTest{
2828
2836
Assertions : []ScriptTestAssertion {
2829
2837
{
2830
2838
Query : "create procedure p() create table t (pk int);" ,
2831
- ExpectedErrStr : "creating tables in stored procedures is currently unsupported and will be added in a future release " ,
2839
+ ExpectedErrStr : "CREATE statements in CREATE PROCEDURE not yet supported " ,
2832
2840
},
2833
2841
{
2834
2842
Query : "create procedure p() begin create table t (pk int); end;" ,
2835
- ExpectedErrStr : "creating tables in stored procedures is currently unsupported and will be added in a future release " ,
2843
+ ExpectedErrStr : "CREATE statements in CREATE PROCEDURE not yet supported " ,
2836
2844
},
2837
2845
},
2838
2846
},
@@ -2844,11 +2852,11 @@ var ProcedureCreateInSubroutineTests = []ScriptTest{
2844
2852
Assertions : []ScriptTestAssertion {
2845
2853
{
2846
2854
Query : "create procedure p() create trigger trig before insert on t for each row begin select 1; end;" ,
2847
- ExpectedErrStr : "creating triggers in stored procedures is currently unsupported and will be added in a future release " ,
2855
+ ExpectedErrStr : "can't create a TRIGGER from within another stored routine " ,
2848
2856
},
2849
2857
{
2850
2858
Query : "create procedure p() begin create trigger trig before insert on t for each row begin select 1; end; end;" ,
2851
- ExpectedErrStr : "creating triggers in stored procedures is currently unsupported and will be added in a future release " ,
2859
+ ExpectedErrStr : "can't create a TRIGGER from within another stored routine " ,
2852
2860
},
2853
2861
},
2854
2862
},
@@ -2858,11 +2866,11 @@ var ProcedureCreateInSubroutineTests = []ScriptTest{
2858
2866
Assertions : []ScriptTestAssertion {
2859
2867
{
2860
2868
Query : "create procedure p() create database procdb;" ,
2861
- ExpectedErrStr : "creating databases in stored procedures is currently unsupported and will be added in a future release " ,
2869
+ ExpectedErrStr : "DBDDL in CREATE PROCEDURE not yet supported " ,
2862
2870
},
2863
2871
{
2864
2872
Query : "create procedure p() begin create database procdb; end;" ,
2865
- ExpectedErrStr : "creating databases in stored procedures is currently unsupported and will be added in a future release " ,
2873
+ ExpectedErrStr : "DBDDL in CREATE PROCEDURE not yet supported " ,
2866
2874
},
2867
2875
},
2868
2876
},
@@ -2872,11 +2880,11 @@ var ProcedureCreateInSubroutineTests = []ScriptTest{
2872
2880
Assertions : []ScriptTestAssertion {
2873
2881
{
2874
2882
Query : "create procedure p() create view v as select 1;" ,
2875
- ExpectedErrStr : "creating views in stored procedures is currently unsupported and will be added in a future release " ,
2883
+ ExpectedErrStr : "CREATE statements in CREATE PROCEDURE not yet supported " ,
2876
2884
},
2877
2885
{
2878
2886
Query : "create procedure p() begin create view v as select 1; end;" ,
2879
- ExpectedErrStr : "creating views in stored procedures is currently unsupported and will be added in a future release " ,
2887
+ ExpectedErrStr : "CREATE statements in CREATE PROCEDURE not yet supported " ,
2880
2888
},
2881
2889
},
2882
2890
},
0 commit comments