alexdesousa / ayesql

Library for using raw SQL in Elixir
MIT License
138 stars 14 forks source link

Adding question mark to sql blows up the compilation #20

Closed thdxr closed 3 years ago

thdxr commented 3 years ago

Not sure if there's some kind of recursive bug but try the following

-- name: sample
select * from test where test ? ARRAY["asd"]

This will fail attempt to compile until memory is all used and the process is killed

thdxr commented 3 years ago

Did some digging, removing the question mark from the following line fixes it: https://github.com/alexdesousa/ayesql/blob/master/src/queries_lexer.xrl#L13

However I'm not certain why it was defined with a question mark in the first place - was it meant as a regex peekahead? Not sure if removing this has side effects

alexdesousa commented 3 years ago

@thdxr Interesting. I have no clue about the ? there. There are no ? tokens in AyeSQL's small language, so there's no reason to filter it from a fragment. This might be a leftover. Same as you, I think this is a bug, and removing it won't affect the lexer.

I saw you forked the project and removed the ?, if it's working for you, feel free to open a PR :smile: Otherwise, I'll eventually get to it.