pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #17109: Fail to evaluate boolean expression properly
3+ messages / 2 participants
[nested] [flat]
* BUG #17109: Fail to evaluate boolean expression properly
@ 2021-07-15 09:38 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 2 replies; 3+ messages in thread
From: PG Bug reporting form @ 2021-07-15 09:38 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: mingodad@gmail.com
The following bug has been logged on the website:
Bug reference: 17109
Logged by: Domingo Alvarez Duarte
Email address: mingodad@gmail.com
PostgreSQL version: 11.10
Operating system: Online at https://extendsclass.com/postgresql-onli
Description:
When proposing a change to
https://github.com/facebookincubator/CG-SQL/pull/62 people there found
several problems on their project and one of the related to how
parse/evaluate expressions around "BETWEEN" keyword and they created a
simple test case to check it (adapted by me):
====
select /*NOT*/ 1 BETWEEN -2 and 2, NOT (1 BETWEEN -2 and 2), (/*NOT*/ 1)
BETWEEN -2 and 2
====
Here is the output of PostgreSQL where the second column is not negated (if
column 1 expression is true then "NOT" that expression should return false
):
====
?column? | ?column? | ?column?
-- | -- | --
true | true | true
====
Here is the output of sqlite3:
====
sqlite3 < "test-between.sql"
1|0|1
====
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #17109: Fail to evaluate boolean expression properly
@ 2021-07-15 10:01 Domingo Alvarez Duarte <mingodad@gmail.com>
parent: PG Bug reporting form <noreply@postgresql.org>
1 sibling, 0 replies; 3+ messages in thread
From: Domingo Alvarez Duarte @ 2021-07-15 10:01 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org
It seems that I fired the trigger to early, although the output of that
website (https://extendsclass.com/postgresql-online.html) does shows
wrong result when executing the query on other places with different
PostgreSQL version the output is the expected one:
psql template1
psql (13.3)
Type "help" for help.
template1=# select /*NOT*/ 1 BETWEEN -2 and 2, NOT (1 BETWEEN -2 and 2),
(/*NOT*/ 1) BETWEEN -2 and 2
template1-# ;
?column? | ?column? | ?column?
----------+----------+----------
t | f | t
(1 row)
On 15/7/21 11:38, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 17109
> Logged by: Domingo Alvarez Duarte
> Email address: mingodad@gmail.com
> PostgreSQL version: 11.10
> Operating system: Online at https://extendsclass.com/postgresql-onli
> Description:
>
> When proposing a change to
> https://github.com/facebookincubator/CG-SQL/pull/62 people there found
> several problems on their project and one of the related to how
> parse/evaluate expressions around "BETWEEN" keyword and they created a
> simple test case to check it (adapted by me):
>
> ====
> select /*NOT*/ 1 BETWEEN -2 and 2, NOT (1 BETWEEN -2 and 2), (/*NOT*/ 1)
> BETWEEN -2 and 2
> ====
>
> Here is the output of PostgreSQL where the second column is not negated (if
> column 1 expression is true then "NOT" that expression should return false
> ):
> ====
> ?column? | ?column? | ?column?
> -- | -- | --
> true | true | true
> ====
>
> Here is the output of sqlite3:
> ====
> sqlite3 < "test-between.sql"
> 1|0|1
> ====
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #17109: Fail to evaluate boolean expression properly
@ 2021-07-15 10:48 Domingo Alvarez Duarte <mingodad@gmail.com>
parent: PG Bug reporting form <noreply@postgresql.org>
1 sibling, 0 replies; 3+ messages in thread
From: Domingo Alvarez Duarte @ 2021-07-15 10:48 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org
Looking again at https://extendsclass.com/postgresql-online.html and
liasing/naming the columns it produces the expected result, so it's a
problem on their website.
Sorry by the noise, this issue can be closed.
====
select /*NOT*/ 1 BETWEEN -2 and 2 as col1, NOT (1 BETWEEN -2 and 2) as
col2, (/*NOT*/ 1) BETWEEN -2 and 2 as col3
====
Output:
====
col1 col2 col3
true false true
====
On 15/7/21 11:38, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 17109
> Logged by: Domingo Alvarez Duarte
> Email address: mingodad@gmail.com
> PostgreSQL version: 11.10
> Operating system: Online at https://extendsclass.com/postgresql-onli
> Description:
>
> When proposing a change to
> https://github.com/facebookincubator/CG-SQL/pull/62 people there found
> several problems on their project and one of the related to how
> parse/evaluate expressions around "BETWEEN" keyword and they created a
> simple test case to check it (adapted by me):
>
> ====
> select /*NOT*/ 1 BETWEEN -2 and 2, NOT (1 BETWEEN -2 and 2), (/*NOT*/ 1)
> BETWEEN -2 and 2
> ====
>
> Here is the output of PostgreSQL where the second column is not negated (if
> column 1 expression is true then "NOT" that expression should return false
> ):
> ====
> ?column? | ?column? | ?column?
> -- | -- | --
> true | true | true
> ====
>
> Here is the output of sqlite3:
> ====
> sqlite3 < "test-between.sql"
> 1|0|1
> ====
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-07-15 10:48 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-07-15 09:38 BUG #17109: Fail to evaluate boolean expression properly PG Bug reporting form <noreply@postgresql.org>
2021-07-15 10:01 ` Domingo Alvarez Duarte <mingodad@gmail.com>
2021-07-15 10:48 ` Domingo Alvarez Duarte <mingodad@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox