Skip to content

Query works on Studio, fails using REST API ( ... is not idempotent) #1589

Closed

Description

@ExtReMLapin

Hello it's me again

ArcadeDB Version:

ArcadeDB Server v24.5.1-SNAPSHOT (build 71472c4c05ae9278d0d5d71a919b31883e1ea767/1713899543605/main) is starting up... creating nodes and reading nodes

OS and JDK Version:

Running on Linux 5.15.0-100-generic - OpenJDK 64-Bit Server VM 11.0.22 for creating nodes and reading nodes

Expected behavior

Query should execute and not fail.

Actual behavior

Error :

{"error":"Cannot execute command","detail":"Query \u0027create vertex type CHUNK\u0027 is not idempotent","exception":"java.lang.IllegalArgumentException"}

mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]: java.lang.IllegalArgumentException: Query 'create vertex type CHUNK' is not idempotent
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at com.arcadedb.query.sql.SQLQueryEngine.query(SQLQueryEngine.java:92)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at com.arcadedb.database.LocalDatabase.query(LocalDatabase.java:1371)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at com.arcadedb.server.ServerDatabase.query(ServerDatabase.java:489)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at com.arcadedb.server.http.handler.GetQueryHandler.execute(GetQueryHandler.java:61)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:100)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at com.arcadedb.server.http.handler.AbstractServerHttpHandler.handleRequest(AbstractServerHttpHandler.java:127)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at io.undertow.server.RoutingHandler.handleRequest(RoutingHandler.java:93)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:104)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:265)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at org.xnio.nio.QueuedNioTcpServer2.acceptTask(QueuedNioTcpServer2.java:178)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
mai 10 09:31:51 cfia-IDEXTEND server.sh[1388]:         at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)

Steps to reproduce

curl -X GET http://localhost:2480/api/v1/query/test/sql/create%20vertex%20type%20CHUNK --user root:rootroot

Do it using Studio and it works

firefox_zbU8AUz3s5.mp4

Yes I also tried the if not exist, it doesn't help, that was my original query.

Activity

  1. gramian commented on May 10, 2024

    @gramian
    Collaborator

    Hi,
    this is by design. To send a command (anything that changes the databases, ie adding a vertex type), you need to use the command endpoint (see https://docs.arcadedb.com/#HTTP-API ). The query endpoint can only be used to read from a database, neither create, update, nor delete are allowed. The studio always uses the command endpoint.

  2. self-assigned this
    on May 10, 2024
  3. ExtReMLapin commented on May 10, 2024

    @ExtReMLapin
    ContributorAuthor

    Alright thanks !

  4. ExtReMLapin commented on May 10, 2024

    @ExtReMLapin
    ContributorAuthor

    Just to be sure @gramian you meant Change the database schema, right ? Because we've been using this same endpoint (/query) to do everything in cypher, create nodes, relations etc, so technically READ, CREATE and UPDATE

    Reading the documentation :

    This command allows executing idempotent commands, like SELECT and MATCH:

    It sounds like yes, I should be in "READ ONLY" using this endpoint, however we can create nodes and edges using Cypher, sounds like something that was missed in the documentation ? Or do you not have the required functions in OpenCypher to detect idempotency ?

  5. gramian commented on May 10, 2024

    @gramian
    Collaborator

    Hmm, that would indeed be a bug. For SQL and SQLscript the query endpoint allows only READ operations. I am not using Cypher or Gremlin so I am referring this to @lvca .

  6. removed their assignment
    on May 10, 2024
  7. added this to the 25.11.1 milestone on Dec 9, 2025
  8. ExtReMLapin commented on Jan 14, 2026

    @ExtReMLapin
    ContributorAuthor

    Fixed by #3112

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions