MonetDB / pymonetdb

The Python API for MonetDB
https://www.monetdb.org/
Mozilla Public License 2.0
28 stars 20 forks source link

Queries ending with comments fail to execute #20

Closed kutsurak closed 7 years ago

kutsurak commented 7 years ago

If the user ends a query with a comment, the query is not executed.

This PR adds a test and the fix.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 87.786% when pulling 14afad45ae491c57acc6ea5198c7401937d83e67 on kutsurak:master into fc232ec528e9016ad6f806890a5ab7ee6cb1e08c on gijzelaerr:master.

gijzelaerr commented 7 years ago

interesting. so MonetDB doesn't execute the query if there is no newline after a comment?

kutsurak commented 7 years ago

Think of it this way:

SELECT * FROM foo; --This is OK because the semicolon is visible to the parser vs SELECT * FROM foo --This is not OK because the semicolon is part of the comment ;

The python wrapper (correctly) does not require the user to add a semicolon to the query, and just concatenates it in the end. If the query that the user gave happens to end with a comment we get the second (faulty) case from above.

gijzelaerr commented 7 years ago

right