如何查询supabase中的文本[]列?

发布于 2025-02-12 00:15:56 字数 778 浏览 2 评论 0 原文

中定义为多维数组的文本列中的值来检索行

我想根据在supabase表

我正在尝试使用以下URL

https://database_url.supabase.co/rest/v1/test_data = in

。 /database_url.supabase.co/rest/v1/test_db?data=In.(1)“ rel =“ nofollow noreferrer”> https://database_url.supabase.co/rest/rest/rest/v1/test_data = data )

但似乎不起作用。错误消息是运算符不存在:text [] ~~未知 提示为没有操作员匹配给定的名称和参数类型。您可能需要添加明确的类型铸件。

任何帮助将不胜感激! 提前致谢。

I want to retrieve rows based on a value being present in text column defined as multidimensional array in Supabase

Table looks like following
enter image description here

I am trying to query this records using following urls

https://DATABASE_URL.supabase.co/rest/v1/test_db?data=in.({"1"})

https://DATABASE_URL.supabase.co/rest/v1/test_db?data=in.(1)

But doesnt seem to work. Error message was operator does not exist: text[] ~~ unknown
with hint being No operator matches the given name and argument types. You might need to add explicit type casts.

Any help will be appreciated!
Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹿童谣 2025-02-19 00:15:56

要通过数组内部的值过滤,您可以使用 cs 运算符,该操作员等同于postgresql中的@> (包含)。

例如,此查询将检索具有值“ 1” 的所有行, Data 列的数组中。

https://DATABASE_URL.supabase.co/rest/v1/test_db?data=cs.{"1"}

To filter by the values inside of an array, you can use the cs operator, which is equivalent to @> (contains) in PostgreSQL.

For instance, this query will retrieve all the rows that have the value "1" present in the array of the data column.

https://DATABASE_URL.supabase.co/rest/v1/test_db?data=cs.{"1"}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文