Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

No way to retrieve column list for an empty table #427

@zachblume

Description

@zachblume

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When querying an empty table, you get an empty array. There is no way to access column names. In a normal table, you can access the keys of the first row object.

To Reproduce

const result = await supabase.from("an_empty_table").select("*");

result.data and result.error work normally but produce no information about columns

Expected behavior

Perhaps behind a flag, like count?

const { data } = await supabase.from("an_empty_table").select("*", { columns: true });
console.assert(data.columns?.length > 0);

System information

  • Version of supabase-js: 2.13.1

Additional context

Why? Because I want to show an empty table view with the columns printed out as a loading state before a user adds a row.

E.g., in my case, they are adding a "person" to a "people" table and when people.length == 0 I still want to show the fields as table headers so visually get an impression of the table, without it directly into the code, and I'm not using the typescript client with generated types, etc., in any case it's a reused component that needs to do so regardless of the model being passed to it.

I noticed you all added this to the Studio codebase a couple years ago:

supabase/supabase#94

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