Questions tagged [supabase-database]

Supabase is a database solution powered by PostgreSQL. Under the hood, Supabase uses PostgREST, an open source tool to make automatically create REST API for PostgreSQL databases. Supabase utilizes row level security feature on top of PostgREST to provide authorization. Use this tag when you are having problems, and not to ask for new features.

Supabase Database is a component of Supabase that automatically creates RESTful APIs for your Supabase database backed by PostgreSQL. Under the hood, Supabase uses PostgREST, an open source tool to create REST APIs for your PostgreSQL database. Supabase utilizes row level security feature on top of PostgREST to provide authorization. Use this tag when you are having problems, and not to ask for new features.

Supabase Database comes with:

  • intuitive table editor
  • clients in various languages to communicate with the database
  • SQL editor to easily run SQL on your database
330 questions
1
vote
0 answers

Supabase array contains

In Firestore, a query for "array contains" is simple. Firestore.firestore().collection("Posts").whereField("members", arrayContains: userid) How can the same query be achieved in Supabase? Getting all documents is not a problem, but I get a status…
Redstain
  • 157
  • 2
  • 10
1
vote
1 answer

Error when importing supabase from createServerClient in generateStaticParams - Next js 13

I'm migrating my app from nextjs 12 to nextjs 13 and I'm having some trouble migrating my [...slug].tsx file. I started with a simple code snippet but I'm getting this error: Error: Invariant: Method expects to have requestAsyncStorage, none…
Emiliano
  • 437
  • 1
  • 4
  • 14
1
vote
1 answer

Could not find the function in the schema cache ( RPC supabase )

Hi I have created a postgres function using the supabase ui with 4 parameters. see this screenshot function definition is begin insert into public.rooms (created_by_id, room_manager_id, room_name,…
1
vote
2 answers

How to fix Postgres error "operator does not exist" using pgvector

I have a Postgres function to find the top 10 most relevant vectors. I called this function from a supabase serverless function, but logs returned 500. The error I get is related to the <#> operator. It seems that PostgreSQL cannot find this…
James Wong
  • 155
  • 2
  • 14
1
vote
2 answers

How to properly add an admin user to supabase?

I'm starting with supabase and I want to implement in my app the ability to SELECT, INSERT, UPDATE and DELETE only for admin users. At the moment I can only create users with the "authenticated" role, is there a way to change this to admin role?…
RodoM
  • 13
  • 4
1
vote
0 answers

supabase: error: duplicate key value violates unique constraint "cartItems_pkey1"

I save data on my database with an RLS feature for authenticated users who can only insert, update, and delete their data; this works well. When I save data on the database, I check if any data with that id exist; if it does,increase the quantity if…
1
vote
0 answers

how to update only a nested json element in supabase

I have a Supabase's postgres database where a row contains a column called jsonData that has many JSON fields: { "key1": "...", "key2": "...", "key3": "...", "key4": "..." } I want to update as an example only the key3 with a new value and…
Gwhyyy
  • 7,554
  • 3
  • 8
  • 35
1
vote
1 answer

Is it possible to run join query in supabase with GraphQL?

I have two tables in supabase category : id (int4 (pk)), name (text) product : id (int4 (pk)), name (text), price (int8), category_id (fk with id of category); What will be the query in my resolver function to fetch category with all related…
1
vote
1 answer

Supabase (Postgres) Row Level Security Based on Role in Table

I'm new to Supabase and Postgres (though not new to SQL) but I'm having a difficult time wrapping my head around writing policies. Let's say I have a member table structured like this: // member // id (text) | name (text) | group (text) | admin…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
1
vote
1 answer

Supabase client (JS): filtering by distance

In supabase Javascript client is it possible to do a distance filter? If possible, I'd like to avoid implementing server-side logic. // Define the distance threshold in meters (50km = 50000m) const distanceThreshold = 50000 const targetLatitude =…
Fedro Zen
  • 11
  • 2
1
vote
1 answer

Supabase Self-Hosted Connection to Default Project (Still connecting)?

I deploy supabase to digitalocean .env: POSTGRES_PASSWORD=MY_PASSWORD JWT_SECRET=MY_JWT_SECRET ANON_KEY=MY_ANON_KEY SERVICE_ROLE_KEY=MY_SERVICE_ROLE_KEY ##…
1
vote
2 answers

How do I select rows that match any value inside an array in supabase?

I want to select all rows that match at least one of given tags from this table: If I want to search by tag1 and tag3 it should return 1st, 3rd and 4th row and when I want to search by tag2 and tag4 it should return all of them because they all…
pelak
  • 68
  • 6
1
vote
0 answers

Why is the data in a Context not updating/completing/getting passed down

I use the following code to fetch the data for my app. export const DataContext = () => { const [posts, setPosts] = useState>([]); const [profiles, setProfiles] = useState>([]); const [page, setPage] =…
Globe
  • 169
  • 11
1
vote
1 answer

Why is my filter for an array returning an empty list when there should be multiple matching items

My data is stored in two separate tables; "posts" and "profiles". Each User object comes from the "profiles" table but also has a list posts which is not a column in "profiles". Because of this, I need to fetch the posts first, then their…
Globe
  • 169
  • 11
1
vote
1 answer

Querying sub-sub table in Supabase / Grandchild relationship in JOIN QUERY

Given the following schema: CREATE TABLE organization ( org_name text NOT NULL, PRIMARY KEY (org_name) ); CREATE TABLE teams ( org_name text NOT NULL, team_name text NOT NULL, PRIMARY KEY (org_name, team_name), FOREIGN KEY…
Mansueli
  • 6,223
  • 8
  • 33
  • 57