Safety belt triggered
Closed this issue · 2 comments
bennieswart commented
Hi, thanks for the great work on this project. We rely on this quite heavily for some very important internal tools.
I recently upgraded from an older version to 5.3 and found this issue:
Python 3.11.3 (main, Jun 5 2023, 09:32:32) [GCC 13.1.1 20230429] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pglast import prettify
>>> prettify('select (false and true) is false', safety_belt=True)
Detected a non-cosmetic difference between this original statement:
select (false and true) is false
and the prettified one:
SELECT FALSE AND TRUE IS FALSE
/home/staple/goodx/goodxweb/.venv/lib/python3.11/site-packages/pglast/__init__.py:116: RuntimeWarning: Detected a non-cosmetic difference between original and prettified statements, please report
warnings.warn("Detected a non-cosmetic difference between original and"
'select (false and true) is false'
EDIT: I'm working through all the errors triggering the safety belt now so I'll add more as I find them.
select a = (true is false)
wrongly gives SELECT a = TRUE IS FALSE
, however select a = (b = c)
correctly gives SELECT a = (b = c)
.
EDIT: Seems like the above examples are the only issues highlighted in my case.
lelit commented
Thanks for the report, I will investigate as soon as possible!
lelit commented
This should be fixed in just released v3, v4 and v5!