@@ -2441,6 +2441,27 @@ var ProcedureCallTests = []ScriptTest{
24412441 },
24422442 },
24432443 },
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+ },
24442465}
24452466
24462467var ProcedureDropTests = []ScriptTest {
@@ -2787,25 +2808,12 @@ var ProcedureShowCreate = []ScriptTest{
27872808}
27882809
27892810var 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- },
28012811 {
28022812 Name : "event must not contain CREATE PROCEDURE" ,
28032813 Assertions : []ScriptTestAssertion {
28042814 {
2805- // Skipped because MySQL errors here but we don't.
28062815 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" ,
28092817 },
28102818 },
28112819 },
@@ -2828,11 +2836,11 @@ var ProcedureCreateInSubroutineTests = []ScriptTest{
28282836 Assertions : []ScriptTestAssertion {
28292837 {
28302838 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 " ,
28322840 },
28332841 {
28342842 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 " ,
28362844 },
28372845 },
28382846 },
@@ -2844,11 +2852,11 @@ var ProcedureCreateInSubroutineTests = []ScriptTest{
28442852 Assertions : []ScriptTestAssertion {
28452853 {
28462854 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 " ,
28482856 },
28492857 {
28502858 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 " ,
28522860 },
28532861 },
28542862 },
@@ -2858,11 +2866,11 @@ var ProcedureCreateInSubroutineTests = []ScriptTest{
28582866 Assertions : []ScriptTestAssertion {
28592867 {
28602868 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 " ,
28622870 },
28632871 {
28642872 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 " ,
28662874 },
28672875 },
28682876 },
@@ -2872,11 +2880,11 @@ var ProcedureCreateInSubroutineTests = []ScriptTest{
28722880 Assertions : []ScriptTestAssertion {
28732881 {
28742882 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 " ,
28762884 },
28772885 {
28782886 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 " ,
28802888 },
28812889 },
28822890 },
0 commit comments