Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions mindsdb_sql_parser/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,10 @@ def INTEGER(self, t):

@_(r"'(?:\\.|[^'])*(?:''(?:\\.|[^'])*)*'")
def QUOTE_STRING(self, t):
t.value = t.value.replace('\\"', '"').replace("\\'", "'").replace("''", "'")
return t

@_(r'"(?:\\.|[^"])*"')
def DQUOTE_STRING(self, t):
t.value = t.value.replace('\\"', '"').replace("\\'", "'")
return t

@_(r'\n+')
Expand Down
4 changes: 2 additions & 2 deletions mindsdb_sql_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2006,11 +2006,11 @@ def integer(self, p):

@_('QUOTE_STRING')
def quote_string(self, p):
return p[0].strip('\'')
return p[0].replace('\\"', '"').replace("\\'", "'").replace("''", "'").strip('\'')

@_('DQUOTE_STRING')
def dquote_string(self, p):
return p[0].strip('\"')
return p[0].replace('\\"', '"').replace("\\'", "'").strip('\"')

# for raw query

Expand Down
4 changes: 2 additions & 2 deletions tests/test_mindsdb/test_selects.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_select_status_column(self):
def test_native_query(self):
sql = """
SELECT status
FROM int1 (select q from p from r)
FROM int1 (select q from p from r where x = 'test''test')
group by 1
limit 1
"""
Expand All @@ -54,7 +54,7 @@ def test_native_query(self):
targets=[Identifier('status')],
from_table=NativeQuery(
integration=Identifier('int1'),
query='select q from p from r'
query="select q from p from r where x = 'test''test'"
),
limit=Constant(1),
group_by=[Constant(1)]
Expand Down
Loading