Skip to content

Type generation: unknown generated for columns of views which are have the row type of a table #534

Open
@joeally

Description

@joeally

Bug report

Describe the bug

In the situation where we have a view in which one of the columns has the row type of a table, unknown is generated for that column.

I've already created a fix for this in the PR #533

To Reproduce

Create a view in the following form that selects from an existing table of yours.

e.g

CREATE VIEW rows_with_user_view AS (
  SELECT *, users as user FROM rows
  INNER JOIN users on rows.user_id = user.id
);

Run type generation and search for rows_with_user_view

{
...typescript
  public: {
    ...
    Views: {
      rows_with_user_view: {
        Row: {
          ...
          user: unknown
        }
      }
    }
    ...
  }
...
}

Expected behavior

{
...
  public: {
    ...
    Views: {
      rows_with_user_view: {
        Row: {
          ...
          user: Database["public"]["Tables"]["users"]["Row"]
        }
      }
    }
    ...
  }
...
}

System information

  • OS: Mac OS 12.0.1 With supabase/postgres-meta running inside docker 20.10.11
  • Version of supabase/postgres-meta: Commit 27128d0

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