The syntax is comparable to CREATE TABLE, except that only field names and types can be specified; no constraints (such as NOT NULL) can presently be included. Note that the AS keyword is essential; without it, the system will think a different kind of CREATE TYPE command is meant, and you will get odd syntax errors. ^1
Composite type declaration field type values then should output with a | null.
An aside: it would also be nice to have support for domains, currently they are generated as unknown type.
drop type t;
create domain notnullint as int not null;
create type t as (a int, b notnullint);
select (1,2)::t;
-- (1,2)
select (1,null)::t;
-- [2024-04-24 09:54:44] [23502] ERROR: domain notnullint does not allow null values
Bug report
Describe the bug
This PR introduced support for composite types, https://github.com/supabase/postgres-meta/pull/459. However, composite type fields can be null.
Composite type declaration field type values then should output with a
| null
.An aside: it would also be nice to have support for domains, currently they are generated as unknown type.