Describe the bug
columns.create / columns.update quote schema-qualified array types as a single identifier. type: 'myschema.foo[]' becomes "myschema.foo"[], which Postgres rejects (type "myschema.foo[]" does not exist).
This shows up when adding array columns of types such as extensions.vector[] or a user type s.my_type[].
To Reproduce
create schema s;
create type s.my_type as enum ('a');
create table public.t();
await pgMeta.columns.create({
table_id,
name: 'c',
type: 's.my_type[]',
})
Expected behavior
The column is created as type "s"."my_type"[] (an array of s.my_type).
Actual behavior
ERROR: type "s.my_type[]" does not exist
ALTER TABLE public.t ADD COLUMN c "s.my_type"[]
Root cause
typeIdent applies ident() to the whole schema.type string when the name ends with [], before splitting on .. Non-array schema-qualified types (s.my_type) were already left unquoted and still work.
Additional context
- Library:
@supabase/postgres-meta
- Branch analyzed:
master (641831e)
Describe the bug
columns.create/columns.updatequote schema-qualified array types as a single identifier.type: 'myschema.foo[]'becomes"myschema.foo"[], which Postgres rejects (type "myschema.foo[]" does not exist).This shows up when adding array columns of types such as
extensions.vector[]or a user types.my_type[].To Reproduce
Expected behavior
The column is created as type
"s"."my_type"[](an array ofs.my_type).Actual behavior
Root cause
typeIdentappliesident()to the wholeschema.typestring when the name ends with[], before splitting on.. Non-array schema-qualified types (s.my_type) were already left unquoted and still work.Additional context
@supabase/postgres-metamaster(641831e)