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

Error after upgrading to v2.33.1: SelectQueryError<"Referencing missing column computed_review_score"> #474

Open
2 tasks done
whollacsek opened this issue Aug 31, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@whollacsek
Copy link

whollacsek commented Aug 31, 2023

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

Error after upgrading to 2.33.1 I'm getting this Typescript error: SelectQueryError<"Referencing missing column 'computed_review_score'">

computed_review_score is a function:

CREATE FUNCTION computed_review_score(event event_ticketing.events) RETURNS numeric
    LANGUAGE sql AS
$$
SELECT COALESCE(event.review_score,
                (SELECT ROUND(AVG((VALUE ->> 'score')::NUMERIC), 1) FROM JSONB_ARRAY_ELEMENTS(event.reviews)));
$$;

And this is the query:

supabaseClient
    .rpc('search_events', payload)
    .select(
      '*, computed_review_score'
    )

Also it is strange that the generated type for this function has unknown for the argument, it should be the table type:

...
    Functions: {
      computed_review_score: {
        Args: {
          event: unknown
        }
        Returns: number
      }
    }
...

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to '…'
  2. Click on '…'
  3. Scroll down to '…'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

@whollacsek whollacsek added the bug Something isn't working label Aug 31, 2023
@lopezjurip
Copy link

lopezjurip commented Feb 6, 2024

Same issue here, broke my entire codebase.

I'm rolled back to an older version that supports computed columns:

"@supabase/postgrest-js": "=1.2.0"
"@supabase/supabase-js": "=2.4.0"

Sadly these version has issues with .maybeSingle(), see #361

@d-e-h-i-o
Copy link

d-e-h-i-o commented Mar 18, 2024

I'm experiencing the same problem with supabase-js 2.39.8 and postgrest-js@1.9.2.

@AlexisKenAlvarez
Copy link

I'm experiencing the same problem with supabase-js 2.39.8 and postgrest-js@1.9.2.

Im having the same issue! Same version
notificationFrom: string & SelectQueryError<"Referencing missing column email">[];

But when I console log it, the object exists

@stefan-girlich
Copy link

Similar problem with supabase-js 2.42.4 and postgrest-js 1.15.2 and updated TypeScript types:

const { data, error } = await supabase.from('category')
    .select('*, parent_category(id, name, color)')

// parent_category: SelectQueryError<"Referencing missing column `color`">[]
// or whatever column is mentioned last in the query

parent_category is set up as a function according to PostgREST docs.

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

5 participants