Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SELECT EXISTS (...) syntax not supported #74

Open
D1360-64RC14 opened this issue May 29, 2023 · 1 comment
Open

SELECT EXISTS (...) syntax not supported #74

D1360-64RC14 opened this issue May 29, 2023 · 1 comment

Comments

@D1360-64RC14
Copy link

The following SQL throws an error:

row := r.db.QueryRow(`
    SELECT EXISTS (
        SELECT
            1
        FROM
            users
        WHERE
            id = ?
    );
`, id)
Syntax error near select exists (

I tried the exact same code on a real MySQL database, and it worked fine.


  • GoLang version: 1.20
  • In go.mod: github.com/proullon/ramsql v0.0.0-20230224205054-8ff679dbf7aa
@D1360-64RC14
Copy link
Author

Also, some possible alternatives, like...

row := r.db.QueryRow(`
    SELECT
        COUNT(id) > 0
    FROM
        users
    WHERE
        id = ?;
`, id)

Syntax error near {6 >}\n

... and...

row := r.db.QueryRow(`
    SELECT
        COUNT(1) > 0
    FROM
        users
    WHERE EXISTS (
        SELECT
            1
        FROM
            users
        WHERE
            id = ?
    );
`, id)

Syntax error near ( 1 )

...didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant