diff --git a/pegjs/sqlite.pegjs b/pegjs/sqlite.pegjs index daea4b5a..0f7ed064 100644 --- a/pegjs/sqlite.pegjs +++ b/pegjs/sqlite.pegjs @@ -2233,7 +2233,7 @@ in_op_right = op:in_op __ LPAREN __ l:expr_list __ RPAREN { return { op: op, right: l }; } - / op:in_op __ e:(var_decl / literal_string / func_call) { + / op:in_op __ e:(var_decl / literal_string / column_ref / func_call) { return { op: op, right: e }; } diff --git a/test/sqlite.spec.js b/test/sqlite.spec.js index b655a6c7..e9b8cee6 100644 --- a/test/sqlite.spec.js +++ b/test/sqlite.spec.js @@ -312,5 +312,9 @@ describe('sqlite', () => { ) SELECT x FROM cnt;` expect(getParsedSql(sql)).to.be.equal(`WITH RECURSIVE "cnt"("x") AS ((1)) SELECT "x" FROM "cnt"`) - }) + }); + it('should support table names with IN clauses', () => { + const sql = `SELECT * FROM pets WHERE owner_name IN people;` + expect(getParsedSql(sql)).to.be.equal('SELECT * FROM "pets" WHERE "owner_name" IN "people"') + }); })