Repository navigation
Description
Summary
CREATE PROPERTY T.n LONG (regexp '[A-Z]+') and ALTER PROPERTY T.n REGEXP '[A-Z]+' are both accepted. A pattern is matched against the value's string form, so a pattern written for text refuses every value of a numeric, boolean, date or binary property. The declaration is written to the schema, reports success, and survives a reopen, leaving a property no value can be written through. The type does not have to be empty for this to pass unnoticed: the existing-records scan only looks at what is already stored, and a type that holds no record of that property has nothing to refuse.
MIN and MAX are already guarded on exactly this ground: LocalProperty.setMin/setMax call checkBound, which refuses a bound the type cannot use (Maximum value not applicable for type BOOLEAN) or cannot read (The MAX 'zz' of property 'R1.n' cannot be read as LONG). REGEXP has no equivalent. The Cypher re-type path refuses to carry a REGEXP onto a non-STRING type for the same reason ("a pattern describes text: on any other type it is matched against the value's string form, which is not what it was written for"), so the same declaration is refused through one door and accepted through another.
Where
engine/src/main/java/com/arcadedb/schema/LocalProperty.java:308-setRegexpassigns and saves, with no readability check:
@Override
public Property setRegexp(final String regexp) {
checkForSchemaMutation();
final boolean changed = !Objects.equals(this.regexp, regexp);
if (changed) {
this.regexp = regexp;
owner.getSchema().getEmbedded().saveConfiguration();
}
return this;
}against setMax/setMin at LocalProperty.java:249/:261, which call checkBound at :283.
engine/src/main/java/com/arcadedb/schema/DocumentType.java:156routes theCREATE PROPERTY ... (regexp ...)and JSON declaration path to the same unguarded setter.engine/src/main/java/com/arcadedb/query/sql/parser/AlterPropertyStatement.java:136is theALTER PROPERTY ... REGEXParm; itsrequireStoredValuesWithinhelper callsDocumentValidator.requireReadableBoundfor MIN and MAX only, then scans the stored records, which is a no-op on a property no record carries.
Repro
CREATE VERTEX TYPE R1;
CREATE PROPERTY R1.n LONG (regexp '[A-Z]+');
INSERT INTO R1 SET n = 1;Observed:
CREATE PROPERTY R1.n LONG (regexp '[A-Z]+') : OK
R1.n JSON : {"type":"LONG","regexp":"[A-Z]+","custom":{}}
INSERT INTO R1 SET n = 1 : EX:ValidationException: The property 'R1.n' does not match the regular expression '[A-Z]+'. Field value is: 1, record: @R1[n=1]
CREATE (x:R1 {n: 1}) : EX:CommandExecutionException
for comparison, MAX is already refused : EX:CommandExecutionException: The MAX 'zz' of property 'R1.n' cannot be read as LONG
and on a BOOLEAN : EX:CommandExecutionException: Cannot set attribute on property max 3: Maximum value not applicable for type BOOLEAN
ALTER PROPERTY R1.n REGEXP '[A-Z]+' on an already declared LONG behaves the same way. After closing and reopening the database:
reopened R1.n : {"type":"LONG","regexp":"[A-Z]+","custom":{}}
INSERT : EX:ValidationException: The property 'R1.n' does not match the regular expression '[A-Z]+'. Field value is: 1, record: @R1[n=1]
Suggested fix
Give LocalProperty.setRegexp the guard setMin/setMax already have, next to checkBound so the two stay in step: refuse a REGEXP on a property whose values are not text, naming the property and its type, the way the Cypher re-type path already names it. As checkBound does, only warn rather than refuse when the schema is being read from file (isReadingFromFile), so a database written before the rule still opens and ALTER PROPERTY ... REGEXP null remains the remedy.
If a pattern over the string form of a numeric value is considered a feature worth keeping ('[0-9]{3}' on a LONG), the narrower rule is to refuse only a pattern that no value of the new type can satisfy, but the simple type check matches what the engine already decided for this exact question in the re-type path and is the one that keeps the two doors consistent.
Scope / confidence
High confidence, reproduced on main at db832c29e7 through the embedded API with the output above. Engine-wide: any SQL, JSON or Java API declaration path reaches setRegexp. The fix is one guard in one setter plus its isReadingFromFile escape; the risk is refusing a pattern an existing database legitimately relies on, which the read-from-file warning path covers.
Activity
Merge pull request #9820 from ArcadeData/worktree-arcadedb-9794-9808-…
lvca commentedon Oct 12, 2026
Fixed in #9820 (26.11.1).
A REGEXP is now refused when it is declared (
CREATE PROPERTY,ALTER PROPERTY, the Java API, a JSON schema) if no value of the property could ever pass it:truenorfalseA pattern on a number or a date stays allowed, because it is useful there (e.g.
'[0-9]{5}'on a LONG). We chose not to refuse every non-STRING type, as suggested: that would have removed this working feature. A database that already holds such a declaration still opens, with a warning;ALTER PROPERTY ... REGEXP nullremoves it.❤️ 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.
Merge origin/main into fix/9747-ha-bare-saveconfiguration-not-shipped
fix(ArcadeData#9794,ArcadeData#9806,ArcadeData#9808,ArcadeData#9777,A…
fix(ArcadeData#9990,ArcadeData#9991,ArcadeData#9976,ArcadeData#9989,A…
fix(#9794,#9806,#9808,#9777,#9812): declared text form in patterns, l…
fix(#9990,#9991,#9976,#9989,#9992): one authority decides which REGEX…