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

Dollar quoted strings not handling semicolon in UPDATE statements #427

Open
hlcianfagna opened this issue Feb 1, 2024 · 9 comments
Open

Comments

@hlcianfagna
Copy link

hlcianfagna commented Feb 1, 2024

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: andialbrecht/sqlparse#763

@hlcianfagna
Copy link
Author

Forgot to mention I tested this with crash 0.31.0

@hlcianfagna
Copy link
Author

It could be related with andialbrecht/sqlparse#307

@amotl
Copy link
Member

amotl commented Feb 1, 2024

Thanks for reporting!

@proddata
Copy link
Member

proddata commented Feb 3, 2024

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$$;']

@proddata
Copy link
Member

proddata commented Feb 5, 2024

Bug raised: andialbrecht/sqlparse#763

@amotl
Copy link
Member

amotl commented Feb 7, 2024

@proddata submitted a fix already. Thanks a stack!

@amotl
Copy link
Member

amotl commented Mar 27, 2024

Hi again.

@amotl amotl reopened this Mar 27, 2024
@andialbrecht
Copy link

A new version of sqlparse will be released in May when LTS support for Django 3.2 has reached its EOL.

@amotl
Copy link
Member

amotl commented Apr 24, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants