Repository navigation
Description
Summary
Four issues in the remote TimeSeries schema surface added by edc38033ea (#7399) and 2ed4dcbe17 (#7335). They are grouped because they share one cause: the remote path renders SQL where the embedded path calls the API, and the two are meant to be equivalent. Each is small on its own; the first is the one that matters.
1. quote() refuses a back-quote and ignores the backslash, re-introducing #5849
/**
* Back-quotes an identifier so a name that collides with a keyword still parses. A name that itself contains a
* back-quote is refused: there is no escape for it in the grammar, and silently concatenating it would let a
* caller-supplied name close the quote and continue the statement.
*/
private static String quote(final String identifier) {
if (identifier.indexOf('`') >= 0)
throw new SchemaException("Identifier '" + identifier + "' cannot be used in SQL: it contains a back-quote");
return "`" + identifier + "`";
}"There is no escape for it in the grammar" is not correct. SQLLexer.g4:511-517 is
QUOTED_IDENTIFIER : BACKTICK ( ~[`\\] | '\\' . )+ BACKTICK
A backslash escapes the next character. Identifier.quote() in the same module exists precisely to escape both characters, and this project already fixed this exact defect once, in MCPToolUtils.quoteIdentifier() under #5849, where the javadoc spells the lexer rule out.
Consequence on the remote path: buildTimeSeriesType().withName("a\\b")...create() renders `a\b`, the server parses the backslash as an escape and stores the type as ab, and create() then fails with "Type with name 'a\b' was not found" while the server keeps a fully built type under a name the caller never asked for. A trailing backslash gives a parse error instead. The embedded path accepts both names.
engine/src/main/java/com/arcadedb/schema/TimeSeriesTypeBuilder.java:267-276- call sites
:202,:204,:234,:246 - reached from
network/src/main/java/com/arcadedb/remote/RemoteTimeSeriesTypeBuilder.java:60and:72
Fix: use Identifier.quote(), or reproduce its escaping, rather than refusing one character and passing the other through.
2. Column order diverges between embedded and remote
renderCreate() has to regroup columns into TIMESTAMP, then TAGS, then FIELDS, because the grammar has one slot for each. The embedded create() replays insertion order:
for (final ColumnDefinition col : columns) type.addTsColumn(col);A recipe declaring a field before the timestamp gives [cpu, ts, host] embedded and [ts, host, cpu] remotely.
TimeSeriesTypeBuilder.java:204-215and:229-239(the regrouping),:353-354(the embedded order)- server side:
engine/src/main/java/com/arcadedb/query/sql/parser/CreateTimeSeriesTypeStatement.java:79-91
This is the third instance of a divergence the same commit normalized twice elsewhere (the precision case, the tier sort). The #7399 acceptance IT declares columns in canonical order, so it cannot see it.
Fix: sort the columns into canonical order on the embedded path too, or document the order as unspecified and stop relying on it.
3. RemoteSchema.reload() keeps a cached type's Java class
RemoteDocumentType type = previous != null ? previous.get(typeName) : null;The kind switch, including the LocalTimeSeriesType.KIND_CODE arm this commit added, runs only when the name is absent from the previous snapshot. So after a drop-and-recreate that changes a type's kind, even an explicit reload() leaves getType(name) instanceof TimeSeriesType false forever on that connection.
network/src/main/java/com/arcadedb/remote/RemoteSchema.java:829-860
Pre-existing line, made consequential by edc38033ea, since before it there was no kind for a remote type to change into.
Fix: re-run the kind switch on reload, and reuse the cached instance only when the kind matches.
4. validate() does not enforce the single-TIMESTAMP rule that validateForSQL() does
if (timestampColumns > 1)
throw new SchemaException(
"CREATE TIMESERIES TYPE declares exactly one TIMESTAMP column, and this builder carries " + timestampColumns);That check is in validateForSQL() only. validate(), which the embedded create() runs, does not have it. JsonlImporterFormat loops withColumn over export JSON, so a two-TIMESTAMP export builds a type whose getTimestampColumn() (the last) disagrees with findTimestampColumnIndex() (the first).
TimeSeriesTypeBuilder.java:282-307(validate()),:311-324(validateForSQL()),:130-136(withColumn)integration/src/main/java/com/arcadedb/integration/importer/format/JsonlImporterFormat.java:475-494engine/src/main/java/com/arcadedb/engine/timeseries/TimeSeriesSealedStore.java:3307-3312
Fix: move the check into validate(), so the rule holds wherever the type is created. That is what validate()'s own javadoc says it is for.
Scope / confidence
Item 1: high confidence, the lexer rule was read in the grammar file at 151799eda2. It stops short of full SQL injection, because the back-quote half of the guard does block re-balancing the quoting, which is why it is not filed as high severity.
Items 2, 3 and 4: high confidence on the mechanism, low individual impact.
Not included here: the partial-construction case where CREATE succeeds and a follow-up ALTER fails, which is real but already owned by #7689. #7335's SQL suggestions were checked against the grammar and are all current productions.
Activity
fix(#7740): keep the declared column order, and refuse a restore that…
Merge pull request #7747 from ArcadeData/fix/issue-7733-7740-7741-774…
lvca commentedon Sep 17, 2026
Fixed in #7747, merged into
mainfor 26.10.1. All four items:a\bbecameabon the server, andcreate()then failed saying the type was not found while the server kept one under a name you never asked for. A trailing backslash was a parse error. Both now work: names are escaped with the same routine the rest of the SQL layer uses, and the injection the old check was guarding against is still refused.CREATE TIMESERIES TYPEcan only spell timestamp, then tags, then fields, so a recipe that interleaves them renders in that grouped order; the JSONL importer refuses a restore if the type it rebuilt does not match the export's own column order, rather than importing values into the wrong columns.reload(). It now picks up the change.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(ArcadeData#7733, ArcadeData#7743, ArcadeData#7732, ArcadeData#7740,
fix(#7868,#7905,#7858,#7906,#7895): carry the owner row, answer trans…
style(engine): import StreamSupport instead of naming it fully, and p…
fix(engine,network,integration,grpcw): 5-issue batch - locale-safe DD…