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

select() does not select all columns by default #507

Closed
2 tasks done
9t8 opened this issue Sep 14, 2024 · 4 comments · Fixed by #509
Closed
2 tasks done

select() does not select all columns by default #507

9t8 opened this issue Sep 14, 2024 · 4 comments · Fixed by #509
Labels
bug Something isn't working

Comments

@9t8
Copy link

9t8 commented Sep 14, 2024

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

The docs say the columns parameter of select() "defaults to *." It does not.

To Reproduce

  1. Run supabase.table("t").select("*"), and get everything in t.
  2. Run supabase.table("t").select(""), and get everything in t.
  3. Run supabase.table("t").select(), and get no data.

Expected behavior

supabase.table("t").select() should get everything in t. I understand "defaults to *" to mean * is the default argument.

@9t8 9t8 added the bug Something isn't working label Sep 14, 2024
@chrisLucchini
Copy link

Hello,

As you've correctly pointed out, there is a discrepancy between the documentation and the actual behavior of the select() method. The documentation states that if no columns are provided, the select() function "defaults to *", which implies that all columns should be selected.
However, in the current implementation, if no arguments are passed to select(), it results in a HEAD request, which doesn't return any data.

I think HEAD request can be useful for users that only check if table exist or not without fetching any data which can slow down the request.
So perhaps an update for documentation is preferable in this case

@grdsdev grdsdev transferred this issue from supabase/supabase-py Sep 24, 2024
@grdsdev
Copy link
Contributor

grdsdev commented Sep 24, 2024

Hi, thanks for reporting this.

Behavior should be aligned between client libs, select() without arguments should default to * all columns.

If you need to use HEAD method, you can specify head=True when calling the select method (just like JS), at least this should be the behavior in Python too.

From what I see, this isn't supported as expected.


This fix would be a breaking change, tho currently it has the wrong behavior, @silentworks what do you think about this?

@silentworks
Copy link
Contributor

I think we should apply the breaking change since this is a bug fix, the current behavior is a bug. We should probably do a minor release and not a patch release for this though.

@grdsdev
Copy link
Contributor

grdsdev commented Sep 25, 2024

Agreed, I'll push a PR with the fix.

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

Successfully merging a pull request may close this issue.

4 participants