Skip to content

An impossible REGEXP is refused at declaration time on only 4 of the 16 types, because the proof is a budgeted search that only narrow types exhaust #9990

Closed

Description

@ruispereira

Summary

The REGEXP usability check refuses an impossible pattern only when the type's text form space is small
enough to exhaust. It proves unsatisfiability by enumerating candidate strings under a fixed budget:

private static final int REGEXP_SEARCH_MAX_PROBES = 65_536;
// probes are what normally ends it (every BYTE is about 12,000 of them, a few milliseconds)

(engine/src/main/java/com/arcadedb/database/DocumentValidator.java:49)

When the budget runs out the pattern is not refused; it carries a doubt instead
(RegexpUsability(String refusal, String doubt), :333). So the type's width decides whether the
refusal fires, not the pattern
, and the wide types are exactly the ones a user is most likely to get
wrong.

Census

Measured over the 16 types the check covers: 4 refuse, 12 accept with a doubt and then refuse every
write.

declaration outcome
BYTE (regexp '[0-9]{4}') refused at declaration, correct
SHORT (regexp '[0-9]{6}') accepted, every write fails
INTEGER (regexp '[0-9]{11}') accepted, every write fails
LONG (regexp '[0-9]{20}') accepted, every write fails
DOUBLE/FLOAT (regexp '[0-9]+') accepted
DECIMAL, and every DATE/DATETIME type accepted

BYTE is the one that works because its whole text form space is about 12,000 probes, as the comment
above says.

In the other direction, .*, which matches every text there is, is warned about on 6 of the 16 types.

Repro

CREATE PROPERTY D.a LONG (regexp '[0-9]{25}');   -- accepted, with a doubt
INSERT INTO D SET a = 7;                         -- throws, and so does every other value

That is the exact symptom #9808 and #9853 were filed about. The mechanism that closed them reaches
only the narrow types.

Suggested fix and the guarantee

The satisfiable direction does not need a search at all, and the sample values it needs already exist
in this repository
: Issue9853TextFormCoversEveryValueTest holds, per type, values whose text forms
span that type's shape. Moving them next to TextForm lets the check ask "does any known value of this
type match the pattern?" and answer definitively and in constant time. The budgeted enumeration then
remains only for the cases those samples do not settle.

The guarantee is a test that asserts, for every type in the enumeration rather than for the two or
three a report named, that a pattern no value of that type can match is refused at declaration time.
A budget dependent check cannot satisfy that test, which is what stops the width of the type from
deciding the outcome again.

Related

This is one of three places that independently decide which pairs of type and pattern are valid; see
also the sibling reports on DROP CONSTRAINT and on the LINK gate. The durable fix is a single
authority the three consult.

Scope

Reproduced at 8564d3ad79.

Activity

  1. added
    engine
    enhancement
    severity:minor
    on Oct 13, 2026
  2. added
    in progress
    on Oct 14, 2026
  3. self-assigned this
    on Oct 14, 2026
  4. added this to the 26.11.1 milestone on Oct 14, 2026
  5. added 7 commits that reference this issue on Oct 14, 2026
  6. 2 remaining items

  7. added a commit that references this issue on Oct 14, 2026
  8. lvca commented on Oct 14, 2026

    @lvca
    Member

    Fixed in #10011 (release 26.11.1).

    A REGEXP that no value of the property's type can match is now refused when it is declared, on every type, not only on narrow ones like BYTE. For example CREATE PROPERTY D.a LONG (regexp '[0-9]{25}') is refused, because a LONG is written with at most 19 digits. The check is now exact for ordinary patterns instead of a limited search. Patterns using back references or look-arounds are still accepted with a warning when they cannot be settled.


    ❤️ 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.

  9. removed
    in progress
    on Oct 14, 2026
  10. added 10 commits that reference this issue on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugengineenhancementseverity:minorsql

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions