Skip to content

Several string functions silently coerce non-STRING inputs instead of raising a type error #5798

Closed

Description

@shulei5831sl

ArcadeDB version

ArcadeDB 26.8.1-SNAPSHOT

Build:

85eb71bb19a39fd1eb36a6fe3ee742862d47d6f6/1785731865672/main

Environment

  • Linux x86_64
  • Docker
  • OpenJDK
  • arcadedata/arcadedb:latest, freshly pulled on 2026-08-03
  • HTTP command API
  • Query language: Cypher

Description

Several string functions silently convert non-STRING input values into text instead of reporting a type error.

For example:

RETURN toUpper(5) AS value;

returns the string "5".

Other non-string values are also accepted:

RETURN toUpper(true) AS value;
// "TRUE"
RETURN toUpper([1,2]) AS value;
// "[1, 2]"
RETURN split(5, ',') AS value;
// ["5"]

The affected functions include:

  • toUpper()
  • toLower()
  • trim()
  • lTrim()
  • rTrim()
  • split()
  • replace()

In each case, the function's primary text input accepts values outside its declared STRING domain and processes a textual representation of the value.

This differs from explicit conversion. Cypher already provides toString() for callers that intentionally want to convert supported scalar values before applying a string operation:

RETURN toUpper(toString(5)) AS value;
// "5"

Silently performing that conversion inside the string function turns invalid type usage into an apparently valid result.

Steps to reproduce

No graph data is required. Run each query separately.

Integer input

RETURN toUpper(5) AS value;

Observed:

"5"

Boolean input

RETURN toUpper(true) AS value;

Observed:

"TRUE"

List input

RETURN toUpper([1,2]) AS value;

Observed:

"[1, 2]"

Non-string input to split()

RETURN split(5, ',') AS value;

Observed:

["5"]

Additional affected functions

RETURN toLower(5) AS value;
// "5"
RETURN trim(5) AS value;
// "5"
RETURN lTrim(5) AS value;
// "5"
RETURN rTrim(5) AS value;
// "5"
RETURN replace(5, 'a', 'b') AS value;
// "5"

Expected behavior

The functions should reject non-STRING inputs with a client-facing type error.

For example:

RETURN toUpper(5) AS value;

should fail because the input is an INTEGER, not a STRING.

Callers that intentionally require conversion can request it explicitly:

RETURN toUpper(toString(5)) AS value;
// "5"

This preserves the distinction between:

invalid type usage
    → type error

and:

explicit conversion followed by a string operation
    → valid string result

Actual behavior

Query ArcadeDB 26.8.1-SNAPSHOT Neo4j 2026.06
RETURN toUpper(5) "5" Type error
RETURN toLower(5) "5" Type error
RETURN trim(5) "5" Type error
RETURN lTrim(5) "5" Type error
RETURN rTrim(5) "5" Type error
RETURN split(5, ',') ["5"] Type error
RETURN replace(5, 'a', 'b') "5" Type error
RETURN toUpper(true) "TRUE" Type error
RETURN toUpper([1,2]) "[1, 2]" Type error
RETURN 5 || 3 Client error Client error

Neo4j documents these function arguments as STRING values and rejects the tested non-string inputs.

The cross-engine comparison is supporting evidence. The primary issue is that ArcadeDB accepts values outside the functions' declared input domain without requiring an explicit conversion.

Controls

Valid string inputs work normally:

RETURN toUpper('abc') AS value;
// "ABC"

Explicit conversion of a supported scalar input also works:

RETURN toUpper(toString(5)) AS value;
// "5"

Null propagation is unaffected:

RETURN toUpper(null) AS value;
// null

The strict concatenation operator rejects unsupported operand types in the tested build:

RETURN 5 || 3 AS value;
// Client error

This is consistent with the type-checking change made for issue #5298. It is included only as an additional internal consistency signal; the function signatures and direct non-string behavior are sufficient to demonstrate the problem.

Isolated recheck

Tested against a fresh arcadedata/arcadedb:latest container with an empty database.

All listed results reproduced identically in three consecutive runs.

Reproduction rate:

3/3

The behavior is deterministic.

Why this appears to be a bug

The affected functions expose a STRING input boundary, but ArcadeDB silently accepts unrelated runtime types and converts them into text.

As a result, the following two expressions become observationally equivalent:

RETURN toUpper(5);
RETURN toUpper(toString(5));

The first expression contains no requested conversion, while the second explicitly requests one. Treating them identically removes the type boundary established by the function signature.

The list case also shows that the behavior is not limited to normal scalar conversion:

RETURN toUpper([1,2]);

returns a formatted textual representation of the list rather than rejecting the unsupported input type.

Impact

Implicit coercion hides invalid type usage and converts data-dependent type errors into silently transformed values.

This can cause manually written or generated queries to succeed unexpectedly when runtime data has the wrong type. Instead of failing at the point where the type assumption is violated, the value enters subsequent string-processing logic as text.

For structured values such as lists, the resulting text may also depend on implementation-level formatting rather than an explicit Cypher conversion contract, making the behavior unsuitable as a stable application-visible representation.

Activity

  1. added this to the 26.9.1 milestone on Aug 3, 2026
  2. self-assigned this
    on Aug 6, 2026
  3. added 2 commits that reference this issue on Aug 7, 2026
  4. added a commit that references this issue on Aug 23, 2026
  5. added a commit that references this issue on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions