Skip to content

columns introspection reports a domain column's **base type**, discarding the domain identity #1092

Description

@coderdan

Bug report

For a column whose type is a DOMAIN, the columns query resolves the column to the domain's base type and never surfaces the domain itself. Both output fields that could carry the type name — format and data_type — collapse to the base type, so downstream consumers (notably the Studio table editor grid) label the column with the base type (text, jsonb, …) instead of the domain name.

Example from CipherStash Encrypt Query Language (EQL):

CREATE DOMAIN public.eql_v3_text_search AS jsonb
    CHECK (
        jsonb_typeof(VALUE) = 'object'
        AND VALUE ? 'v'
        AND VALUE ? 'i'
        AND VALUE ? 'c'
        AND VALUE->>'v' = '3'
    );

Creating a table with this type works but the API reports the type as jsonb instead of the domain.

Image

Schema visualizer shows the type as jsonb:

Image

The meta API response:

curl -s "http://127.0.0.1:54321/pg/tables?included_schemas=public" | jq
{
     // ...
     {
        "table_id": 23315,
        "schema": "public",
        "table": "users",
        "id": "23315.3",
        "ordinal_position": 3,
        "name": "name",
        "default_value": "NULL::jsonb",
        "data_type": "jsonb",
        "format": "jsonb",
        "is_identity": false,
        "identity_generation": null,
        "is_generated": false,
        "is_nullable": true,
        "is_updatable": true,
        "is_unique": false,
        "enums": [],
        "check": null,
        "comment": null
    }
}
// ...

psql shows the correct domain type name:

Image

psql \d shows the domain name for the same column, because it uses format_type(atttypid) (domain-aware). The Studio "New column" type picker also shows the domain name, because it comes from the types query (format_type(t.oid)). Only the columns path flattens it — so the same type is displayed inconsistently across the UI.

Environment

  • postgres-meta v0.96.1 (bundled with Supabase CLI 2.84.2); also present on master @ f21a4da.

  • PostgreSQL 15 (Supabase local dev stack) and Supabase hosted.

  • I confirm this is a bug with Supabase, not with my own application.

  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions