Skip to content

DROP CONSTRAINT cannot be executed for a non STRING property carrying a REGEXP, leaving a constraint that can be created but not removed #9991

Closed

Description

@ruispereira

Summary

DROP CONSTRAINT can be impossible to execute. A property that carries a REGEXP and is not a STRING
cannot have that constraint dropped, because the drop path restores the saved declaration through a
check that refuses the combination outright.

The refusing line is hand written, and sits two lines above a sibling arm that delegates the same kind
of decision to a shared helper:

// a pattern describes text: on any other type it is matched against the value's string form, ...
if (existing.getRegexp() != null && newType != Type.STRING)
  notCarried.add("REGEXP '" + existing.getRegexp() + "' (" + newType + " values are not text)");

final String minReason = boundNotCarried(database, oldType, newType, existing.getMin());
...
final String maxReason = boundNotCarried(database, oldType, newType, existing.getMax());

(engine/src/main/java/com/arcadedb/query/opencypher/query/OpenCypherQueryEngine.java:719)

MIN and MAX ask boundNotCarried, which consults the real type rules. REGEXP answers from a literal
newType != Type.STRING.

Repro

Take the fixture of #9645, which creates a LONG property carrying a REGEXP, and then try to remove the
constraint:

  • DROP CONSTRAINT ... fails.
  • DROP CONSTRAINT ... IF EXISTS also fails, although the whole point of IF EXISTS is to be
    executable regardless.
  • The constraint remains listed by SHOW CONSTRAINTS.

The only way out is ALTER PROPERTY ... REGEXP null, which throws the pattern away rather than
dropping the constraint that names it.

The refusal protects nothing

The same end state is reachable by hand in three statements, verified. So the check does not prevent
the configuration from existing; it only prevents the user from undoing it through the statement that
exists for undoing it.

Suggested fix and the guarantee

Delegate the REGEXP arm to the same authority the MIN and MAX arms use, so that one place decides
which pairs of type and pattern are valid, and DROP CONSTRAINT restores whatever was validly saved.

The guarantee is a round trip test: for every constraint kind and every type, a constraint that could
be created must be droppable. A state the system allowed you to reach and does not allow you to
leave is the invariant being broken here, and it is cheap to assert over the full matrix.

Related

One of three places that independently decide which pairs of type and pattern are valid, alongside
#9990 and the LINK gate report. The durable fix is a single authority the three consult.

Scope

Reproduced at 8564d3ad79.

Activity

  1. added
    engine
    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 a commit that references this issue on Oct 14, 2026
  6. lvca commented on Oct 14, 2026

    @lvca
    Member

    Fixed in #10011 (release 26.11.1).

    DROP CONSTRAINT now restores the property exactly as it was declared before the type constraint, REGEXP included. Moving a REGEXP between types follows the same rule as declaring it: it is kept when some value of the new type can match it (for example '[0-9]+' between LONG and STRING), and refused otherwise.


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

  7. removed
    in progress
    on Oct 14, 2026
  8. added a commit that references 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

bugengineopencypherseverity:minor

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions