crash
crash copied to clipboard
Dollar quoted strings not handling semicolon in UPDATE statements
select $$test;test$$;
--> works
create table test(a text);
insert into test(a) values ($$test;test$$);
--> works
update test set a=$$test;test$$;
--> fails (works from the Admin UI)
edit: Bug raised at sqlparse: https://github.com/andialbrecht/sqlparse/issues/763
Forgot to mention I tested this with crash 0.31.0
It could be related with https://github.com/andialbrecht/sqlparse/issues/307
Thanks for reporting!
It could be related with andialbrecht/sqlparse#307
I don't think it is.
The issue only seems to happen with =$$
>>> sqlparse.split('''update test set a=$$test;test$$;''');
['update test set a=$$test;', 'test$$;']
>>> sqlparse.split('''update test set a to $$test;test$$;''');
['update test set a to $$test;test$$;']
>>> sqlparse.split('''update test set a = $$test;test$$;''');
['update test set a = $$test;test$$;']
>>> sqlparse.split('''SELECT * FROM t01 WHERE x = $$test;test$$;''');
['SELECT * FROM t01 WHERE x = $$test;test$$;']
>>> sqlparse.split('''SELECT * FROM t01 WHERE x =$$test;test$$;''');
['SELECT * FROM t01 WHERE x =$$test;', 'test$$;']
Bug raised: https://github.com/andialbrecht/sqlparse/issues/763
@proddata submitted a fix already. Thanks a stack!
- https://github.com/andialbrecht/sqlparse/pull/764
Hi again.
- https://github.com/andialbrecht/sqlparse/pull/764 has been merged. Thank you so much, @proddata and @andialbrecht. 💯
- After a new release of sqlparse has been published on PyPI, this needs to be concluded with a corresponding update and (just a little) test case over here.
A new version of sqlparse will be released in May when LTS support for Django 3.2 has reached its EOL.
Hi again. sqlparse 0.5 has been released, and the most recent release of crash, version 0.31.5, permits to use it. Thank you so much for your contributions and support!
pip install --upgrade sqlparse
- https://github.com/crate/crash/pull/437
- https://github.com/crate/crash/releases/tag/0.31.5