[MDEV-32222] different behaviour with "INTO @var1" for MySQL and MariaDB Created: 2023-09-21  Updated: 2023-10-03

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Richard Stracke Assignee: Ralf Gebhardt
Resolution: Unresolved Votes: 0
Labels: Compatibility


 Description   

MySQL 5.7
 
mysql> (SELECT 1 INTO @var1);
Query OK, 1 row affected (0.00 sec)

MariaDB (tested with 10.4 and 10.8)
 
MariaDB [d1]> (SELECT 1 INTO @var1);
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 'into @var1)' at line 1



 Comments   
Comment by Sergei Golubchik [ 2023-09-21 ]

what kind of behavior do you expect from

select 1+(select 1 into @var1);

?

Comment by Sergei Golubchik [ 2023-09-22 ]

This is not a bug. The correct standard syntax is

<select statement: single row> ::=
  SELECT [ <set quantifier> ] <select list>
      INTO <select target list>
      <table expression>

and that's what MariaDB implements. Extending the syntax to support optional parentheses around the whole statement could be possible, but it'd be a feature, not a bug fix.

I'll change the issue to a "task" as it's a valid feature request

Generated at Thu Feb 08 10:29:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.