Closed cben closed 4 years ago
I can work on this unless you beat me to it.
I can work on this unless you beat me to it.
I do not think I will beat you to it :-)
p.s. we have a workaround using strings e.g. 'false' and 'true' see: https://github.com/yaacov/tree-search-language/blob/36e7e9f7edc10fbdc961a870e13b8cb5d800703e/pkg/walkers/semantics/walk.go#L137
p.p.s using strings to represent boolean is not that uncommon: http://www.postgresqltutorial.com/postgresql-boolean/
Thanks.
That workaround is in Semantics walker;
doesn't work with SQL walker
CORRECTION: workaround did work for me. SQL walker doesn't know column types, it passes all consts though to the generated SQL and as I happen to use Postgres, which does accept 'f'
, 'false'
, '0'
etc.
This differs by DB of course. E.g. in SQLite and MySQL booleans are just alias to integers https://modern-sql.com/blog/2019-01/sqlite-in-2018#boolean
I still want to add true boolean literals support to TSL syntax.
Parsing e.g.
managed = FALSE
fails. Indeed the grammar doesn't have boolean literals: https://github.com/yaacov/tree-search-language/blob/b3a2bd7a1518111c50fd7235d153c52285e2d113/TSL.g4#L42-L45Using
managed = 0
,managed != 1
instead seems to work (using SQL walker, in backend for cloud.redhat.com/openshift). But this is not what user expects for a boolean field.