Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count on foreign table does not exist in type #479

Closed
2 tasks done
dejorrit opened this issue Sep 20, 2023 · 2 comments
Closed
2 tasks done

Count on foreign table does not exist in type #479

dejorrit opened this issue Sep 20, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@dejorrit
Copy link

  • 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

Selecting count from a foreign table returns Typescript error. This is my query:

const { data } = await supabase
      .from("projects")
      .select("*, cards(count)");

And this is the type of data:

const data: {
    created_at: string | null;
    id: string;
    name: string;
    owner_id: string | null;
    updated_at: string | null;
    cards: SelectQueryError<"Referencing missing column `count`">[];
}[] | null

And more specific:

Property 'count' does not exist on type 'SelectQueryError<"Referencing missing column `count`">'.

When selecting id instead of count on the foreign table everything works as expected.

To Reproduce

See above

Expected behavior

I expect count: number to be part of the generated type

Screenshots

image
@dejorrit dejorrit added the bug Something isn't working label Sep 20, 2023
@saltcod saltcod transferred this issue from supabase/supabase Sep 21, 2023
@steve-chavez steve-chavez transferred this issue from supabase/supabase-js Sep 21, 2023
@ThisIsSimmon
Copy link

I have the same problem.

"@supabase/auth-helpers-nextjs": "^0.8.1",
"@supabase/supabase-js": "^2.38.0",

@encima
Copy link
Member

encima commented Feb 1, 2024

Closing in favour of #447 and tracking there

@encima encima closed this as completed Feb 1, 2024
bnjmnt4n added a commit to bnjmnt4n/postgrest-js that referenced this issue Feb 8, 2024
bnjmnt4n added a commit to bnjmnt4n/postgrest-js that referenced this issue Feb 23, 2024
bnjmnt4n added a commit to bnjmnt4n/postgrest-js that referenced this issue Mar 3, 2024
steve-chavez pushed a commit that referenced this issue Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants