rqlite / sql

Pure Go SQL parser
MIT License
138 stars 23 forks source link

Subquery seem to fail though accepted by sqlite3. #8

Closed lcaballero closed 5 days ago

lcaballero commented 1 year ago

Hi, I think this is a bug, but I'm not terribly familiar with this library and sql derivative.

This sql query:

SELECT
  count(),
  'user without role',
  id
FROM
  user as u
WHERE
  u.id
NOT IN (
  SELECT user_id
  FROM mm_user_access_role
)
;

But produces this error:

err: 11:3: expected expression, found 'SELECT'

prochac commented 5 months ago

Here is a different example, but I believe it has the same root cause

SELECT column1,
       CASE
           WHEN column2 > 50
               THEN (SELECT column3
                     FROM bokume
                     WHERE id = fokume.id)
           ELSE 'value'
           END
FROM fokume;