MichaelDBA/pg_get_tabledef

Columns with a custom type (citext) referencing the wrong schema

alaister opened this issue · 4 comments

Hey Michael,
Thanks for fixing the last bug. Found another small one:

With the following SQL:

create extension citext schema extensions;

create table public.example (
  id uuid not null primary key default gen_random_uuid(),
  name extensions.citext not null
);

The definition is showing as:

create table public.example (
    id uuid not null default gen_random_uuid (),
    name public.citext not null,
    constraint example_pk primary key (id)
  ) tablespace pg_default;

As you can see, the definition should show the type of name as extensions.citext, but it's showing as public.citext.

@alaister Finally got around to fixing this. Please test and validate. Thanks.

Curious, exactly how does pg_get_tabledef fit into supabase? clone table?

We're using it in the table definition tab inside our table editor:
Screenshot 2023-08-04 at 7 20 20 pm

Originally this feature was only for views, but we then extended it to tables with the help of this awesome library 🙌🏻

Cool!