OrhanC1
OrhanC1

Reputation: 1410

Supabase Error: more than one row returned by a subquery used as an expression

I have two tables bands_profiles and bands.

I'm trying to get all bands that a user is part of.

The JS query I've written is

const usersBands = await supabase
    .from("bands_profiles")
    .select("*, bands(*)")
    .eq("profile_id", userResponse.data.user.id);

My expected outcome is to get a response with all my bands_profiles rows with data populated from bands so that when I write usersBands.data[0].name, I get the name for the associated foreign key.

My actual outcome is that I get a message saying more than one row returned by a subquery used as an expression.

I've only got one row in bands_profiles and bands.

Upvotes: 0

Views: 49

Answers (1)

OrhanC1
OrhanC1

Reputation: 1410

I looked through my existing RLS code and found that there were queries there that were producing multiple rows.

Upvotes: 0

Related Questions