GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — SQL division not working via "query" endpoint · Issue #802 · ArcadeData/arcadedb

SQL division not working via "query" endpoint #802

New issue
Copy link
New issue
Copy link
Closed
Closed
SQL division not working via "query" endpoint#802
Copy link
Assignees
lvca

Description

@gramian
gramian
opened on Jan 24, 2023
Issue body actions

ArcadeDB Version: v23.1.1 (build aa687e4/1673895089679/main)

JDK Version: openjdk 11.0.17 2022-10-1

OS: MacOS 12.6

The division via the query endpoint with a field argument like a / 4 gives an error. The same query works with command endpoint.

Expected behavior

Element-wise division of fields.

Actual behavior

Error on command execution (GetQueryHandler)

Trace
com.arcadedb.exception.CommandSQLParsingException: SELECT a%2F4 FROM nums;
	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.query(SQLQueryEngine.java:91)
	at com.arcadedb.database.EmbeddedDatabase.query(EmbeddedDatabase.java:1279)
	at com.arcadedb.server.ServerDatabase.query(ServerDatabase.java:431)
	at com.arcadedb.server.http.handler.GetQueryHandler.execute(GetQueryHandler.java:68)
	at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:85)
	at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:123)
	at io.undertow.server.RoutingHandler.handleRequest(RoutingHandler.java:93)
	at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:104)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
	at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:256)
	at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
	at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162)
	at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100)
	at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)
	at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at org.xnio.nio.QueuedNioTcpServer2.acceptTask(QueuedNioTcpServer2.java:178)
	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
Caused by: com.arcadedb.query.sql.parser.ParseException: Encountered " <INTEGER_LITERAL> "4 "" at line 1, column 12.
Was expecting one of:
    <EOF> 
    <LIMIT> ...
    <SKIP2> ...
    <OFFSET> ...
    <TIMEOUT> ...
    <AS> ...
    <LET> ...
    <UNWIND> ...
    ";" ...
    "," ...
    ":" ...
    ":" ...
    <AS> ...
    "," ...
    ":" ...
    <AS> ...
    <AS> ...
    <AS> ...
    <AS> ...
    <AS> ...
    <AS> ...
    
	at com.arcadedb.query.sql.parser.SqlParser.generateParseException(SqlParser.java:26213)
	at com.arcadedb.query.sql.parser.SqlParser.jj_consume_token(SqlParser.java:26058)
	at com.arcadedb.query.sql.parser.SqlParser.Parse(SqlParser.java:245)
	at com.arcadedb.query.sql.parser.StatementCache.parse(StatementCache.java:111)
	... 23 more

Steps to reproduce

Given a database test with a type nums with property a holding numbers, then:

SELECT a/4 FROM nums;

does not work when used like:

curl -X GET "http://localhost:2480/api/v1/query/test/sql/SELECT%20a%2F4%20FROM%20nums%3B" --user root:arcadedb

Activity

  1. lvca
    self-assigned this
    on Feb 9, 2023
  2. lvca commented on Feb 9, 2023

    @lvca
    lvca
    on Feb 9, 2023
    Member
    More actions

    It looks like it's a common security problem using the slash in the query parameters. In Tomcat and Undertow docs, there is a special settings to enable that:

    (Source https://undertow.io/undertow-docs/undertow-docs-2.0.0/index.html)


    ALLOW_ENCODED_SLASH
    If a request comes in with encoded / characters (i.e. %2F), will these be decoded. This can cause security problems (link:http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0450) if a front end proxy does not perform the same decoding, and as a result this is disabled by default.


  3. lvca commented on Feb 9, 2023

    @lvca
    lvca
    on Feb 9, 2023
    Member
    More actions

    I guess it's safer to use the POST for this.

  4. lvca
    closed this as completedon Feb 9, 2023
  5. gramian commented on Feb 9, 2023

    @gramian
    gramian
    on Feb 9, 2023
    CollaboratorAuthor
    More actions

    I agree. I will add a note to the docs about this.

    Maybe a function like div() should be added?

    Reacted by Luca Garulli
  6. lvca commented on Feb 9, 2023

    @lvca
    lvca
    on Feb 9, 2023
    Member
    More actions

    I like to be more clear in the docs around the GET /query, not crazy about having a new div() function.

  7. gramian commented on Feb 9, 2023

    @gramian
    gramian
    on Feb 9, 2023
    CollaboratorAuthor
    More actions

    Alright.

    This problem also extends to block comments /* ... */ BTW

    I will add a note to the query endpoint docu about division and block comments.

    Reacted by Luca Garulli
  8. mergify
    added a commit that references this issue on Aug 29, 2025

    chore(studio-deps-dev)(deps-dev): bump copy-webpack-plugin from 11.0.…

    468a41c
  9. mergify
    added a commit that references this issue on Sep 29, 2025

    chore(deps): bump io.github.ascopes:protobuf-maven-plugin from 3.9.1 …

    efc10b4
  10. tae898
    added 2 commits that reference this issue on Jun 28, 2026

    chore(studio-deps-dev)(deps-dev): bump copy-webpack-plugin from 11.0.…

    4b080ca

    chore(deps): bump io.github.ascopes:protobuf-maven-plugin from 3.9.1 …

    aee0fb6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @lvca
    lvca

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.