Supabase Extended icon

Supabase Extended

Interact with Supabase database and storage

Database → Find or Create

AI-generated

Summary

Finds an existing record matching specified column criteria or creates a new row if no match is found.

Inputs

  • table (required) — Name of the Supabase database table to query or insert into.
  • matchColumns (required) — Collection of column name and value pairs used to look up an existing record. At least one match column is required.
  • additionalColumns — Collection of additional column name and value pairs applied only when inserting a new record.

Output shape

a single record

Returns the matched or inserted database row object along with boolean flags _found and _created indicating whether the row was found or newly created.

Examples

Example 1: Find or create a user by email address

Table: 'users', Match Columns: email = 'alex@example.com', Additional Columns: name = 'Alex', status = 'active'

Example 2: Ensure a product tag exists before assigning it

Table: 'tags', Match Columns: slug = 'featured', Additional Columns: display_name = 'Featured Products'

Links

Discussion