[MDEV-10351] Prepared statement with parameters in new DEFAULT syntax fails with syntax error upon execution Created: 2016-07-09  Updated: 2016-10-28  Resolved: 2016-10-28

Status: Closed
Project: MariaDB Server
Component/s: Parser, Prepared Statements
Affects Version/s: 10.2.1
Fix Version/s: 10.2.2

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-10134 Add full support for DEFAULT Closed

 Description   

MariaDB [test]> set @a=1, @b=2;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> prepare stmt from "create or replace table t1 (i int default (?+?))";
Query OK, 0 rows affected (0.00 sec)
Statement prepared
 
MariaDB [test]> execute stmt using @a,@b;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?+?)' at line 1

I guess it's not a big deal not to have this functionality, but the error is confusing, especially since this works:

MariaDB [test]> prepare stmt from "create or replace table t1 (i int default (?))";
Query OK, 0 rows affected (0.00 sec)
Statement prepared
 
MariaDB [test]> execute stmt using @a;
Query OK, 0 rows affected (0.65 sec)



 Comments   
Comment by Sergei Golubchik [ 2016-07-10 ]

This is tested in the default.test. It happens not when the parser parses CREATE TABLE statement, but when a table is opened (which also happens during table creation).

Generated at Thu Feb 08 07:41:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.