dolt icon indicating copy to clipboard operation
dolt copied to clipboard

support for `:=` operator in SELECT

Open sillydong opened this issue 3 years ago • 4 comments

We have queries like select @id := id from table limit 1. This is basically query some data into a variable. It is fully supported in MySQL, but for this project, when I run the query, I got ERROR 1105 (HY000): syntax error at position 13 near ':' which means the content := is not supported.

Is there any plan to support such query?

sillydong avatar Dec 29 '21 05:12 sillydong

We would like to support this and it's on our roadmap, but we don't have an ETA for when it will become available.

In the meantime, you can use this syntax, which does the same thing:

set @id = (select id from table limit 1);

zachmu avatar Jan 03 '22 19:01 zachmu

Is it like the two PRs I posted in vitess project which only need add some rules in sql.y or there is more work to do in this project? Could you share some instructions to me for achieving this and we can see if I can make it happen.

sillydong avatar Jan 06 '22 15:01 sillydong

It's harder. It's not just syntax, it's got query planner logic too.

zachmu avatar Jan 11 '22 21:01 zachmu

Support for := for variable assignment is added here. This PR does not include := operator usage in SELECT as it is deprecated in MySQL.

jennifersp avatar Nov 09 '23 00:11 jennifersp