Skip to content

Query an Array for an Element #2480

@auntyellow

Description

@auntyellow

Some DBs like Postgres or MongoDB support ARRAY type and can search within them, e.g.

CREATE TABLE test_array (id INT PRIMARY KEY, val INT ARRAY);
INSERT INTO test_array (id, val) VALUES (1, ARRAY[2, 3]), (2, ARRAY[4, 6]);
SELECT id, val FROM test_array WHERE 4 = ANY(val);

Got 2, {4, 6}.

or MongoDB:

db.test_array.insert([{val: [2, 3]}, {val: [4, 6]}]);
db.test_array.find({val: 4});

Got {_id:..., val: [4, 6]}.

H2 also supports ARRAY type, but how can H2 search an element from an array?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions