© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3w ago•
2 replies
wiz

Selecting table rows right after inserting a new one

edge functions🟡javascript🟢SQL
const { error: insertPlayerError } = await supabase
.from("room_players")
.insert({ room_id: id });

if (insertPlayerError) {
throw insertPlayerError;
}

const { data: joinedPlayers, error: selectPlayersError } = await supabase
.from("room_players")
.select('player_id')
.eq('room_id', id);

if (selectPlayersError) {
throw selectPlayersError;
}

The problem here is that joinedPlayers does not include the player inserted right before, what could be the issue? No errors are thrown and row is inserted successfully when viewing table in dashboard.
I know I could take data from insert operation and add it to joinedPlayers, but shouldn't it work the way it is?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Selecting symmetric rows in sql
SupabaseSSupabase / help-and-questions
4y ago
Selecting Row After Trigger
SupabaseSSupabase / help-and-questions
4y ago
Inserting a row from another table that has children from a supporting table
SupabaseSSupabase / help-and-questions
3y ago
Is there a way to restrict selecting of only certain rows based on a table column through RLS?
SupabaseSSupabase / help-and-questions
4y ago