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

MonetDBe stumble over ':' in the query string #127

Open
ghost opened this issue Apr 21, 2021 · 2 comments
Open

MonetDBe stumble over ':' in the query string #127

ghost opened this issue Apr 21, 2021 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ghost
Copy link

ghost commented Apr 21, 2021

Parsing error in handling a correct query

To Reproduce

import monetdbe

conn=  monetdbe.connect(':memory:')
cur = conn.cursor()
res= cur.execute("create table tmp(i integer, s string)")
res= cur.execute("insert into tmp values(123, 'hello''world'':\n ERROR');");
rows = res.fetchall()
print(rows)

raise ProgrammingError(f"unexpected symbol '{symbol}' in operation")
monetdbe.exceptions.ProgrammingError: unexpected symbol ':' in operation

Expected behavior
This is a normal query string that works on MonetDB

@ghost ghost added the bug Something isn't working label Apr 21, 2021
@gijzelaerr gijzelaerr self-assigned this Apr 21, 2021
@gijzelaerr gijzelaerr added this to the 0.10 milestone Apr 21, 2021
@gijzelaerr gijzelaerr modified the milestones: 0.10, 0.11 Apr 30, 2021
@gijzelaerr
Copy link
Collaborator

This is solved in the current master by switching to monetdbe engine style query preparation logic, but the python logic still has an issue with this. So I'm leaving this open so I can solve it on the python side for the next release.

@gijzelaerr
Copy link
Collaborator

comment from Sjoerd:

Officially, the only special character inside a single quote delimited string in SQL is a single quote, and you double it to get one single quote in your string. Similarly for double quote (for quoting identifiers).
We currently also recognize \ in single-quoted strings, but shoudln't. You should use an E (e) prefix (like Python raw strings) to get backslash escapes. We also recognize the R (r) prefix which is similar to Python's, except a string can end with one backslash. And single quote is still special.

@gijzelaerr gijzelaerr modified the milestones: 0.10, 0.11 May 7, 2021
@gijzelaerr gijzelaerr modified the milestones: 0.11, 0.12 Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant