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

Problem with some boolean expressions not being allowed [CORE4177] #4503

Closed
firebird-automations opened this issue Aug 12, 2013 · 9 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @asfernandes

select 1
from rdb$database
where true is true

Work is correct

select 1
from rdb$database
where (1=1) and true

Work is correct

select 1
from rdb$database
where (1=1) is true

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 3, column 13.
is.

Commits: a34a77d ba923bc FirebirdSQL/fbt-repository@202a10a FirebirdSQL/fbt-repository@dce254a

====== Test Details ======

Test contains temply commented code:
--This currently FAILS. Will be uncommented later in case of post-fix for this ticket:
--select 1 x4c
--from rdb$database
--where not false and not false is not not not false;

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @sim1984

select 1 as f
from rdb$database
where true = true is true

Work is correct

select 1 as f
from rdb$database
where true is true is true

Work is correct

select 1 as f
from rdb$database
where true = true = true

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 3, column 19.
=.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 2 [ 10560 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

One more sample, fails on recent FB versions:

show version;

select 1 x4a
from rdb$database
where not false and not false is not false;


select 1 x4b
from rdb$database
where not false and not false = not not not false;


select 1 x4c
from rdb$database
where not false and not false is not not not false;

Output:

ISQL Version: WI-T3.0.0.31733 Firebird 3.0 Beta 2
Server version:
Firebird/Windows/Intel/i386 (access method), version "WI-T3.0.0.31733 Firebird 3.0 Beta 2"
Firebird/Windows/Intel/i386 (remote server), version "WI-T3.0.0.31733 Firebird 3.0 Beta 2/tcp (csprog)/P13"
Firebird/Windows/Intel/i386 (remote interface), version "WI-T3.0.0.31733 Firebird 3.0 Beta 2/tcp (csprog)/P13"
on disk structure version 12.0

     X4A

============
1

     X4B

============
1

Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 3, column 42
-not
At line 13 in file c4177e.sql

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done with caveats

Test Details: Test contains temply commented code:
--This currently FAILS. Will be uncommented later in case of post-fix for this ticket:
--select 1 x4c
--from rdb$database
--where not false and not false is not not not false;

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

Reopened - see issue dated 27/Mar/15 01:45 PM.

One more sample, now with BETWEEN operator:

recreate table test1(id int, x boolean);
insert into test1 values(107, false);
insert into test1 values(109, false);
insert into test1 values(117, true );
insert into test1 values(121, true );
insert into test1 values(122, false);
insert into test1 values(128, true );
insert into test1 values(137, false);
insert into test1 values(144, false);

Then:

select * from test1 where x between true and true;

      ID       X 

============ =======
117 <true>
121 <true>
128 <true>
// OK.

select * from test1 where x between true and not false;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 46
-not
At line 15 in file c4227.sql

select * from test1 where x between not false and true;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 37
-not
At line 17 in file c4227.sql

select * from test1 where x between (not false) and (not false);

      ID       X 

============ =======
117 <true>
121 <true>
128 <true>

But may be this is not bug and usage of parenthesis is mandatory for such cases ?

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Reopened [ 4 ]

resolution: Fixed [ 1 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

There is operator IS [NOT] {TRUE | FALSE | UNKNOWN}

There is no operator IS [NOT] <expression> for IS NOT NOT ...

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Reopened [ 4 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

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

No branches or pull requests

2 participants