Skip to content

Docs: TRAVERSE * FROM <target> is documented in three places and is a syntax error #9080

Closed

Description

@tae898

The TRAVERSE page gives TRAVERSE [<type.]field>|* as the syntax and uses TRAVERSE * FROM ... in its first example and in the $path example. The SELECT page uses it for $depth. The parser rejects * after TRAVERSE; TRAVERSE out() FROM ... (the form with a function) works.

Syntax (sql-traverse.adoc line 12):

TRAVERSE [<type.]field>|*

First example (line 42):

ArcadeDB> TRAVERSE * FROM #10:1234

$path example (line 112):

ArcadeDB> SELECT $path FROM (TRAVERSE * FROM V)

SELECT page (sql-select.adoc line 232):

ArcadeDB> SELECT $path, $depth FROM ( TRAVERSE * FROM Movie WHERE $depth <= 5 )

Repro

One Java file against the engine API (Database, database.command(...)), no Python, no bindings. Compile it against the engine jars of a build and run it with the database path as the first argument. The block below is the whole file.

import com.arcadedb.database.*;
import com.arcadedb.query.sql.executor.*;

// sql-traverse.adoc and sql-select.adoc: TRAVERSE * FROM <target>.
public class TraverseStar {
  static Database db;

  static void run(String lang, String q) {
    String out;
    try {
      out = exec(lang, q);
    } catch (com.arcadedb.exception.TransactionException e) {
      db.begin();
      try { out = exec(lang, q); db.commit(); } catch (Throwable t) { if (db.isTransactionActive()) db.rollback(); out = describe(t); }
    } catch (Throwable t) {
      out = describe(t);
    }
    System.out.println(lang + " | " + q.replace("\n", " ") + "\n      -> " + out);
  }

  static String exec(String lang, String q) {
    try (ResultSet rs = db.command(lang, q)) {
      StringBuilder sb = new StringBuilder();
      int n = 0;
      while (rs.hasNext()) { Result r = rs.next(); if (n++ < 3) sb.append(r.toJSON()).append(' '); }
      return "rows=" + n + " " + sb;
    }
  }

  static String describe(Throwable t) {
    return t.getClass().getSimpleName() + ": " + String.valueOf(t.getMessage()).split("\n")[0];
  }

  public static void main(String[] a) throws Exception {
    DatabaseFactory f = new DatabaseFactory(a[0]);
    if (f.exists()) f.open().drop();
    db = f.create();
    System.out.println("version " + com.arcadedb.Constants.getRawVersion() + " build " + com.arcadedb.Constants.getBuildNumber() + " java " + System.getProperty("java.version"));
    run("sql", "CREATE VERTEX TYPE V2");
    run("sql", "CREATE EDGE TYPE E2");
    run("sql", "CREATE VERTEX V2 SET name = 'a'");
    run("sql", "TRAVERSE * FROM V2");
    run("sql", "SELECT $path FROM (TRAVERSE * FROM V2)");
    run("sql", "TRAVERSE out() FROM V2");
    run("sql", "TRAVERSE out(), in() FROM V2");
    db.close();
  }
}

I ran it against the engine jars of three builds, 26.10.1-SNAPSHOT at b22b5e9 (current main), 26.10.1-SNAPSHOT at 04bb03e and the 26.9.1 release (9cea8e8), each on Temurin 25.0.4 with -XX:+UseCompactObjectHeaders and on Temurin 21.0.12. The output below is from main on JDK 25; the other five runs print the same lines (compared line by line, after removing the created flag that 26.9.1 does not print).

version 26.10.1-SNAPSHOT build b22b5e99547576dc8ce804d22fe9cdca4573cf29 java 25.0.4
sql | CREATE VERTEX TYPE V2
      -> rows=1 {"operation":"create vertex type","typeName":"V2","created":true} 
sql | CREATE EDGE TYPE E2
      -> rows=1 {"operation":"create edge type","typeName":"E2","created":true} 
sql | CREATE VERTEX V2 SET name = 'a'
      -> rows=1 {"name":"a","@cat":"v","@type":"V2","@rid":"#1:0"} 
sql | TRAVERSE * FROM V2
      -> CommandSQLParsingException: SQL syntax error at line 1, column 9: extraneous input '*' expecting {CUSTOM, DOCUMENT, VERTEX, EDGE, TYPE, TYPES, SUPERTYPE, FROM, TO, WHERE, WHILE, VALUE, VALUES, SET, ADD, PUT, MERGE, MODE,  ...
sql | SELECT $path FROM (TRAVERSE * FROM V2)
      -> CommandSQLParsingException: SQL syntax error at line 1, column 28: extraneous input '*' expecting {CUSTOM, DOCUMENT, VERTEX, EDGE, TYPE, TYPES, SUPERTYPE, FROM, TO, WHERE, WHILE, VALUE, VALUES, SET, ADD, PUT, MERGE, MODE, ...
sql | TRAVERSE out() FROM V2
      -> rows=1 {"name":"a","@cat":"v","@type":"V2","@rid":"#1:0"} 
sql | TRAVERSE out(), in() FROM V2
      -> rows=1 {"name":"a","@cat":"v","@type":"V2","@rid":"#1:0"} 

Cause

The statement is TRAVERSE (traverseProjectionItem (COMMA traverseProjectionItem)*)? FROM ... and a traverseProjectionItem is expression (AS? identifier)?; * is not an expression.

Expected behavior

Either TRAVERSE * should be accepted (the page says it traverses all fields of the record) or the three examples and the syntax line should be rewritten with out(), in() or both(). I do not know which one is intended.

Related issues

No issue found for TRAVERSE *.

Activity

  1. added
    documentation
    severity:minor
    on Oct 3, 2026
  2. added this to the 26.10.1 milestone on Oct 3, 2026
  3. added
    in progress
    on Oct 3, 2026
  4. self-assigned this
    on Oct 3, 2026
  5. removed
    in progress
    on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationseverity:minorsql

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions