Skip to content

INSERT INTO A BUCKET b / CREATE VERTEX A BUCKET b accepts a bucket that belongs to no type: the record skips A's UNIQUE index, is invisible to SELECT FROM A, reads back with @type null and can never be updated #12959

Closed

Description

@shaunpatterson

Summary

INSERT INTO A BUCKET b ... and CREATE VERTEX A BUCKET b ... (and the Java API newDocument("A")...save("b")) refuse a bucket that belongs to another type (#11206: "Cannot create a record of type 'A' in bucket 'B_0', which belongs to type 'B'"). A bucket that belongs to no type is accepted, though. The record is then reported back as an A but is not one:

  • it skips A's indexes, so a UNIQUE key already taken in A is accepted, twice;
  • SELECT FROM A, SELECT FROM A WHERE k = 9 and MATCH (n:A) do not see it;
  • reading the bucket shows @type: null;
  • it can never be modified afterwards: UPDATE bucket:loose ... answers "Cannot modify vertex Bump icu4j from 68.2 to 69.1 #8:0: bucket 'loose' belongs to no type. Attach it to a type with ALTER TYPE ... BUCKET +";
  • ALTER TYPE A BUCKET +loose is then refused too, because of the duplicate keys the first point let in.
CREATE VERTEX TYPE A; CREATE PROPERTY A.k INTEGER; CREATE INDEX ON A (k) UNIQUE
CREATE VERTEX TYPE B; CREATE BUCKET loose
INSERT INTO A SET k = 1                    -> 200 #1:0
INSERT INTO A BUCKET B_0 SET k = 2         -> 400 Cannot create a record of type 'A' in bucket 'B_0', which belongs to type 'B'
INSERT INTO A BUCKET loose SET k = 1       -> 200 {"@rid": "#8:0", "@type": "A", "k": 1}     (duplicate of #1:0's key)
INSERT INTO A BUCKET loose SET k = 1       -> 200 #8:1                                       (and again)
CREATE VERTEX A BUCKET loose SET k = 9     -> 200 #8:2
SELECT count(*) FROM A                     -> 1
SELECT FROM A WHERE k = 9                  -> []
SELECT @rid, @type, k FROM bucket:loose    -> three rows, "@type": null
UPDATE bucket:loose SET k = 10             -> 400 Cannot modify vertex #8:0: bucket 'loose' belongs to no type ...
ALTER TYPE A BUCKET +loose                 -> 409 Duplicated key [1] found on index 'loose_...'

Repro: insert_into_typeless_bucket.py (stdlib only; creates insert_into_typeless_bucket_repro). Main 8da9049d98.

Cause

LocalDatabase.createRecordNoLock (around line 1550) checks the bucket owner with if (owner != null && !owner.getName().equals(doc.getTypeName())). A null owner falls through, so the record is written into a bucket no type reads.

Expected

Refuse it like the other-type case. For example: "Cannot create a record of type 'A' in bucket 'loose', which belongs to no type: attach it first with ALTER TYPE A BUCKET +loose". That is the same remedy the update refusal already names. INSERT INTO bucket:loose SET ... without a type is already refused ("Record type is not specified").

Activity

  1. added
    engine
    severity:major
    in progress
    on Nov 21, 2026
  2. added this to the 26.12.1 milestone on Nov 21, 2026
  3. self-assigned this
    on Nov 22, 2026
  4. added 2 commits that reference this issue on Nov 22, 2026
  5. robfrank commented on Nov 22, 2026

    @robfrank
    Collaborator

    Fixed by #12964, shipping in 26.12.1.

    INSERT INTO A BUCKET x, CREATE VERTEX A BUCKET x, INSERT INTO BUCKET:x FROM SELECT ..., MOVE VERTEX ... TO BUCKET:x and the Java API save("x") used to accept a bucket that belongs to no type. The record was reported as an A but skipped A's indexes (a UNIQUE key could be taken twice), was invisible to SELECT FROM A and MATCH, and could not be updated afterwards.

    Such a write is now refused, like writing into a bucket owned by another type:

    Cannot create a record of type 'A' in bucket 'loose', which belongs to no type: attach it first with ALTER TYPE A BUCKET +loose``

    Attach the bucket to the type first and the write works. A refused MOVE VERTEX leaves the vertex where it was. Records already written into such a bucket before the upgrade are not touched.

    Nothing is left open.


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

  6. removed
    in progress
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugengineseverity:majorsql

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions