Supabase Extended icon

Supabase Extended

Interact with Supabase database and storage

Database → Custom Query

AI-generated

Summary

Execute a raw SQL query against the Supabase database using PostgreSQL RPC helper functions.

Inputs

  • customSql (required) — The raw SQL statement to execute.

Output shape

a list of items or a single status object

Statements starting with SELECT, WITH, EXPLAIN, or TABLE execute via the exec_sql_select RPC and return each row as an item (or a single summary item if empty). Other statements execute via the exec_sql RPC and return a single success status object.

Examples

Example 1: Run a custom SELECT query with joins

Set Custom SQL to "SELECT u.id, u.email, COUNT(o.id) AS total_orders FROM users u LEFT JOIN orders o ON u.id = o.user_id GROUP BY u.id, u.email;"

Example 2: Execute a non-query SQL command

Set Custom SQL to "UPDATE user_profiles SET status = 'active' WHERE last_login > NOW() - INTERVAL '30 days';"

Links

Discussion