Skip to content

Detect Array columns via Column#array - #260

Open
cbisnett wants to merge 1 commit into
PNixx:masterfrom
huntresslabs:claude/upstream-array-column
Open

Detect Array columns via Column#array#260
cbisnett wants to merge 1 commit into
PNixx:masterfrom
huntresslabs:claude/upstream-array-column

Conversation

@cbisnett

@cbisnett cbisnett commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

The base ActiveRecord Column does not define array. Each adapter that supports arrays adds it on its own Column subclass (e.g. PostgreSQL). The ClickHouse Column never did, so tooling that detects array columns via column.respond_to?(:array) && column.array (such as annotaterb) silently treated Array(...) columns as their scalar subtype.

Add Column#array, matching the top-level Array(...) SQL type, and have the schema dumper reuse it instead of re-deriving array-ness from a regex. Also fix the schema dumper's map-value regex so Map(_, Array(_)) columns are dumped as map: :array (the intended single-option form) rather than relying on the previous match-anywhere behavior; both forms reload to the same SQL type.

The base ActiveRecord Column does not define array/array?; each adapter
that supports arrays adds it on its own Column subclass (e.g. PostgreSQL).
The ClickHouse Column never did, so tooling that detects array columns
via `column.respond_to?(:array) && column.array` (such as annotaterb)
silently treated `Array(...)` columns as their scalar subtype.

Add `Column#array`, matching the top-level `Array(...)` SQL type, and
have the schema dumper reuse it instead of re-deriving array-ness from a
regex. Also fix the schema dumper's map-value regex so `Map(_, Array(_))`
columns are dumped as `map: :array` (the intended single-option form)
rather than relying on the previous match-anywhere behavior; both forms
reload to the same SQL type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants