goldmedal commented on code in PR #13327: URL: https://github.com/apache/datafusion/pull/13327#discussion_r1835700101
########## datafusion/sqllogictest/test_files/prepare.slt: ########## @@ -77,6 +81,28 @@ EXECUTE my_plan('Foo', 'Bar'); statement error Prepared statement \'my_plan\' already exists PREPARE my_plan(STRING, STRING) AS SELECT * FROM (VALUES(1, $1), (2, $2)) AS t (num, letter); +# deallocate a plan +statement ok +DEALLOCATE my_plan; + +# can't EXECUTE a deallocated plan +statement error Prepared statement \'my_plan\' does not exist +EXECUTE my_plan('Foo', 'Bar'); + +# re-prepare a deallocated plan +statement ok +PREPARE my_plan(STRING, STRING) AS SELECT * FROM (VALUES(1, $1), (2, $2)) AS t (num, letter); + +query IT +EXECUTE my_plan('Foo', 'Bar'); +---- +1 Foo +2 Bar + +# deallocate with the PREPARE keyword +statement ok +DEALLOCATE PREPARE my_plan; + Review Comment: I think we can simplify the test to ```suggestion query IT EXECUTE my_plan('Foo', 'Bar'); ---- 1 Foo 2 Bar # deallocate a plan statement ok DEALLOCATE my_plan; # can't EXECUTE a deallocated plan statement error Prepared statement \'my_plan\' does not exist EXECUTE my_plan('Foo', 'Bar'); ``` 1. Test the preparation works. 2. Test Deallcocate 3. Test the deallocated query can't be executed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org