ygrek / sqlgg

SQL Guided (code) Generator
https://ygrek.org/p/sqlgg/
GNU General Public License v2.0
62 stars 20 forks source link

Support for IN clause with tuple sets in generated SQL queries #132

Closed sewenthy closed 1 month ago

sewenthy commented 5 months ago

Description

The following query works in MariaDB:

SELECT col3 FROM table1
WHERE (col1, col2) IN (('x', 1), ('y', 2));

I want to generate a similar query using sqlgg:

SELECT col3 FROM table1
WHERE (col1, col2) IN @col1_col2_set;

When trying to generate this query using sqlgg, I encounter the following error:

Tokens: , col2) IN @col1_col2_set
Error: Sqlgg.Sql_parser.MenhirBasics.Error

Expected Behavior

sqlgg should generate the function that accept a list of tuples with correct types of col1 and col2.