© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
3 replies
Max52

Only insert nullable column if not null

I'm inserting a row into my threads table and I want to only include a reference to the categories table if the user selects a category.

I'd like to be able to just insert as usual (
{category_id: category}
{category_id: category}
and if category is null, the column stays null. The issue is I get an error stating that it cannot be inserted as a uuid. Thoughts?
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

Query for non-null values in a nullable column
SupabaseSSupabase / help-and-questions
3y ago
Only INSERT if reservation doesn't exist yet.
SupabaseSSupabase / help-and-questions
4y ago
Insert value into enum column in database
SupabaseSSupabase / help-and-questions
4y ago
Why is the created_at column nullable by default?
SupabaseSSupabase / help-and-questions
4y ago