harelba / q

q - Run SQL directly on delimited files and multi-file sqlite databases

Home Page:http://harelba.github.io/q/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Literal 'From' in WHERE clause misparsed

allanstreib opened this issue · comments

echo  "a,b\nTraveling From Abroad,To Home" | q -H -d, "select * from - where a = 'Traveling From Abroad'"

produces the reponse "No files matching 'Abroad'' have been found"

Workaround

echo  "a,b\nTraveling From Abroad,To Home" | q -H -d, "select * from - where a like 'Traveling%Abroad'"

produces the (correct) response "Traveling From Abroad,To Home"

I think you miss the -e option for echo, but in fact the input doesn't matter so much to reproduce the bug (which it seems to be).

Yes, you may need that. On my platform (OpenBSD/ksh) it is the default behavior.

That's why you use printf instead of echo, avoids these ambiguities ;-)

Hi, sorry for the late response. I'm focused on packaging in order to release a new major version 3.0.0 with lots of big changes.

I'll dive into this right after the release is done.

Regardless, after this release, the next step would be to finally have a proper AST parsing mechanism for the SQL parsing, that will mitigate such issues.