doltgresql icon indicating copy to clipboard operation
doltgresql copied to clipboard

`CAST(ARRAY[...]::regtype[] AS oidvector)` fails

Open tititoof opened this issue 3 months ago • 0 comments

Environment: dolthub/doltgresql:1.2.0 (Docker), connecting via psql (PostgreSQL 17.11 client) or the Ruby pg gem.

Repro:

SELECT ARRAY['character varying'::regtype]::oidvector;

Actual:

ERROR:  EXPLICIT CAST: cast from `regtype[]` to `oidvector` does not exist: ARRAY['character varying'::REGTYPE]

Expected: returns an oidvector value, as in real PostgreSQL ({1043}).

Why it matters: this exact cast is used internally by Ruby on Rails' ActiveRecord PostgreSQL adapter to probe whether a native lower(character varying) function/cast exists (used to build case-insensitive comparisons). Any Rails model using validates :column, uniqueness: { case_sensitive: false } on a varchar/text column fails to save — not just fails the validation, the query itself errors out. Minimal Rails-side trigger:

validates :nickname, uniqueness: { case_sensitive: false }
MyModel.create!(nickname: "test") # raises PG::InternalError instead of saving

tititoof avatar Aug 22 '26 07:08 tititoof