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

Fix malformed array literal cause by Contains & ContainedBy functions #46

Merged
merged 1 commit into from
Jan 28, 2024
Merged

Conversation

whoiscarlo
Copy link
Contributor

What kind of change does this PR introduce?

Correctly formatting the array used by the Contains & ContainedBy functions

Bug fix, feature, docs update, ...
Arrays in Postgres use this string format {10000, 10000, 10000, 10000} or {"meeting", "lunch"}

What is the current behavior?

value []string{"foo", "bar"} turns into foo bar

Please link any relevant issues here.
#43

What is the new behavior?

Will turn values []string{"foo", "bar"} into '{"foo", "bar"}

Additional context

https://www.postgresql.org/docs/current/arrays.html

@yusufpapurcu
Copy link
Member

yusufpapurcu commented Jan 27, 2024

Hey, thanks for contribution 👋
Supabase uses PostgREST underneath to expose postgres as an API. What we have in the client code is written according to that. Here is the related documentation about it.
https://postgrest.org/en/stable/references/api/tables_views.html#horizontal-filtering

To be honest PostgREST documentation doesn't clarify the question "How the arrays should be represented?". So it would be great if you test the expected behaviour and edge cases and link to the PR.

(Also I will be trying it as well 🙂 )

@muratmirgun
Copy link
Member

Hey, first of all, thank you,
I have created a new local setup and cases for this pr and will test it completely fine.
I will get back to your additions

@yusufpapurcu
Copy link
Member

I tested the usecase and it works with your PR!

@yusufpapurcu yusufpapurcu merged commit 7cc315c into supabase-community:main Jan 28, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants