Skip to content

SQL: Boolean operators with null argument #895

@gramian

Description

@gramian

ArcadeDB Version: v23.1.2 (build 9dbe3ce/1675373316135/main)

JDK Version: openjdk 11.0.18 2023-01-17

OS: MacOS 12.6

Boolean operators with null arguments produce an error, for example:

SELECT (true AND null)

Expected behavior

See https://stackoverflow.com/questions/44318788/null-values-boolean-expression#44318916 and https://en.wikipedia.org/wiki/Three-valued_logic#SQL

Actual behavior

Cannot execute command Encountered " "(" "( "" at line 1, column 8. Was expecting one of: <DISTINCT> ... <DISTINCT> ... <DISTINCT> ... <DISTINCT> ... <DISTINCT> ... <DISTINCT> ... 
Error on command execution (PostCommandHandler)
com.arcadedb.exception.CommandSQLParsingException: SELECT (null OR true) limit 25
	at com.arcadedb.query.sql.parser.StatementCache.throwParsingException(StatementCache.java:126)
	at com.arcadedb.query.sql.parser.StatementCache.parse(StatementCache.java:116)
	at com.arcadedb.query.sql.parser.StatementCache.get(StatementCache.java:70)
	at com.arcadedb.query.sql.SQLQueryEngine.parse(SQLQueryEngine.java:207)
	at com.arcadedb.query.sql.SQLQueryEngine.command(SQLQueryEngine.java:102)
	at com.arcadedb.database.EmbeddedDatabase.command(EmbeddedDatabase.java:1250)
	at com.arcadedb.server.ServerDatabase.command(ServerDatabase.java:416)
	at com.arcadedb.server.http.handler.PostCommandHandler.executeCommand(PostCommandHandler.java:127)
	at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:88)
	at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:91)
	at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:128)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.arcadedb.query.sql.parser.ParseException: Encountered " "(" "( "" at line 1, column 8.
Was expecting one of:
    <DISTINCT> ...
    <DISTINCT> ...
    <DISTINCT> ...
    <DISTINCT> ...
    <DISTINCT> ...
    <DISTINCT> ...
    
	at com.arcadedb.query.sql.parser.SqlParser.generateParseException(SqlParser.java:26917)
	at com.arcadedb.query.sql.parser.SqlParser.jj_consume_token(SqlParser.java:26762)
	at com.arcadedb.query.sql.parser.SqlParser.Projection(SqlParser.java:4733)
	at com.arcadedb.query.sql.parser.SqlParser.SelectWithoutTargetStatement(SqlParser.java:1481)
	at com.arcadedb.query.sql.parser.SqlParser.QueryStatement(SqlParser.java:1430)
	at com.arcadedb.query.sql.parser.SqlParser.StatementInternal(SqlParser.java:1234)
	at com.arcadedb.query.sql.parser.SqlParser.Statement(SqlParser.java:1004)
	at com.arcadedb.query.sql.parser.SqlParser.Parse(SqlParser.java:245)
	at com.arcadedb.query.sql.parser.StatementCache.parse(StatementCache.java:111)
	... 16 more

Steps to reproduce

SELECT (true AND null)
SELECT (false AND null)
SELECT (true OR null)
SELECT (false OR null)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy