The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: examples (#33183)
Charis93885b090f81
diff --git a/apps/docs/components/MDX/quickstart_db_setup.mdx b/apps/docs/components/MDX/quickstart_db_setup.mdxindex 429787a8b68..cd282520da8 100644--- a/apps/docs/components/MDX/quickstart_db_setup.mdx+++ b/apps/docs/components/MDX/quickstart_db_setup.mdx@@ -4,7 +4,7 @@ Go to [database.new](https://database.new) and create a new Supabase project.When your project is up and running, go to the [Table Editor](https://supabase.com/dashboard/project/_/editor), create a new table and insert some data.-Alternatively, you can run the following snippet in your project's [SQL Editor](https://supabase.com/dashboard/project/_/sql/new). This will create a `countries` table with some sample data.+Alternatively, you can run the following snippet in your project's [SQL Editor](https://supabase.com/dashboard/project/_/sql/new). This will create a `instruments` table with some sample data.</StepHikeCompact.Details>@@ -12,18 +12,18 @@ Alternatively, you can run the following snippet in your project's [SQL Editor](```sql SQL_EDITOR-- Create the table- create table countries (+ create table instruments (id bigint primary key generated always as identity,name text not null);-- Insert some sample data into the table- insert into countries (name)+ insert into instruments (name)values- ('Canada'),- ('United States'),- ('Mexico');+ ('violin'),+ ('viola'),+ ('cello');- alter table countries enable row level security;+ alter table instruments enable row level security;```</StepHikeCompact.Code>@@ -37,8 +37,8 @@ Make the data in your table publicly readable by adding an RLS policy:<StepHikeCompact.Code>```sql SQL_EDITOR- create policy "public can read countries"- on public.countries+ create policy "public can read instruments"+ on public.instrumentsfor select to anonusing (true);```diff --git a/apps/docs/content/guides/auth/server-side/nextjs.mdx b/apps/docs/content/guides/auth/server-side/nextjs.mdxindex e8063865be1..d15a4bf80f6 100644--- a/apps/docs/content/guides/auth/server-side/nextjs.mdx+++ b/apps/docs/content/guides/auth/server-side/nextjs.mdx@@ -928,9 +928,9 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {You can also fetch static data at build time using Supabase. Note that there's no session or user at build time, so the data will be the same for everyone who sees the page.-Add some countries data to your database by running the [Countries Quickstart](https://supabase.com/dashboard/project/_/sql/quickstarts) in the dashboard.+Add some colors data to your database by running the [Colors Quickstart](https://supabase.com/dashboard/project/_/sql/quickstarts) in the dashboard.-Then fetch the countries data using `getStaticProps` with the client from `@/utils/supabase/static-props.ts`.+Then fetch the colors data using `getStaticProps` with the client from `@/utils/supabase/static-props.ts`.</StepHikeCompact.Details>@@ -946,7 +946,7 @@ export default function PublicPage({ data }: { data?: any[] }) {export async function getStaticProps() {const supabase = createClient()- const { data, error } = await supabase.from('countries').select()+ const { data, error } = await supabase.from('colors').select()if (error || !data) {return { props: {} }diff --git a/apps/docs/content/guides/auth/server-side/sveltekit.mdx b/apps/docs/content/guides/auth/server-side/sveltekit.mdxindex bd41b4276c1..c7c6fecebaf 100644--- a/apps/docs/content/guides/auth/server-side/sveltekit.mdx+++ b/apps/docs/content/guides/auth/server-side/sveltekit.mdx@@ -308,7 +308,7 @@ Create your first page. This example page calls Supabase from the server to getThis is an example of a public page that uses publicly readable data.-To populate your database, run the [countries quickstart](/dashboard/project/_/sql/quickstarts) from your dashboard.+To populate your database, run the [colors quickstart](/dashboard/project/_/sql/quickstarts) from your dashboard.</StepHikeCompact.Details>@@ -320,21 +320,21 @@ To populate your database, run the [countries quickstart](/dashboard/project/_/simport type { PageServerLoad } from './$types'export const load: PageServerLoad = async ({ locals: { supabase } }) => {- const { data: countries } = await supabase.from('countries').select('name').limit(5).order('name')- return { countries: countries ?? [] }+ const { data: colors } = await supabase.from('colors').select('name').limit(5).order('name')+ return { colors: colors ?? [] }}``````svelte src/routes/+page.svelte<script>let { data } = $props()- let { countries } = $derived(data)+ let { colors } = $derived(data)</script><h1>Welcome to Supabase!</h1><ul>- {#each countries as country}- <li>{country.name}</li>+ {#each colors as color}+ <li>{color.name}</li>{/each}</ul>```diff --git a/apps/docs/content/guides/database/debugging-performance.mdx b/apps/docs/content/guides/database/debugging-performance.mdxindex 7970377daff..2a7a64dbc52 100644--- a/apps/docs/content/guides/database/debugging-performance.mdx+++ b/apps/docs/content/guides/database/debugging-performance.mdx@@ -14,7 +14,7 @@ subtitle: 'Debug slow-running queries using the Postgres execution planner.'{/* prettier-ignore */}```sql-- enable explain-alter role authenticator+alter role authenticatorset pgrst.db_plan_enabled to 'true';-- reload the config@@ -28,28 +28,28 @@ To get the execution plan of a query, you can chain the `explain()` method to a{/* prettier-ignore */}```tsconst { data, error } = await supabase- .from('countries')+ .from('instruments').select().explain()```### Example data-To illustrate, consider the following setup of a `countries` table:+To illustrate, consider the following setup of a `instruments` table:{/* prettier-ignore */}```sql-create table countries (+create table instruments (id int8 primary key,name text);-insert into countries+insert into books(id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```### Expected response@@ -60,7 +60,7 @@ The response would typically look like this:```markdownAggregate (cost=33.34..33.36 rows=1 width=112)-> Limit (cost=0.00..18.33 rows=1000 width=40)- -> Seq Scan on countries (cost=0.00..22.00 rows=1200 width=40)+ -> Seq Scan on instruments (cost=0.00..22.00 rows=1200 width=40)```By default, the execution plan is returned in TEXT format. However, you can also retrieve it as JSON by specifying the `format` parameter.@@ -97,11 +97,11 @@ To disable the `explain()` method after use, execute the following SQL commands:{/* prettier-ignore */}```sql-- disable explain-alter role authenticator+alter role authenticatorset pgrst.db_plan_enabled to 'false';-- if you used the above pre-request-alter role authenticator+alter role authenticatorset pgrst.db_pre_request to '';-- reload the configdiff --git a/apps/docs/content/guides/database/joins-and-nesting.mdx b/apps/docs/content/guides/database/joins-and-nesting.mdxindex 5285543e530..8921f0e568d 100644--- a/apps/docs/content/guides/database/joins-and-nesting.mdx+++ b/apps/docs/content/guides/database/joins-and-nesting.mdx@@ -8,7 +8,7 @@ The data APIs automatically detect relationships between Postgres tables. Since## One-to-many joins-Let's use an example database that stores `countries` and `cities`:+Let's use an example database that stores `orchestral_sections` and `instruments`:<Tabsscrollable@@ -19,50 +19,50 @@ Let's use an example database that stores `countries` and `cities`:><TabPanel id="table" label="Tables">-**Countries**+**Orchestral sections**-| `id` | `name` |-| ---- | -------------- |-| 1 | United Kingdom |-| 2 | United States |+| `id` | `name` |+| ---- | --------- |+| 1 | strings |+| 2 | woodwinds |-**Cities**+**Instruments**-| `id` | `name` | `country_id` |-| ---- | ----------- | ------------ |-| 1 | London | 1 |-| 2 | Manchester | 1 |-| 3 | Los Angeles | 2 |-| 4 | New York | 2 |+| `id` | `name` | `section_id` |+| ---- | ------ | ------------ |+| 1 | violin | 1 |+| 2 | viola | 1 |+| 3 | flute | 2 |+| 4 | oboe | 2 |</TabPanel><TabPanel id="SQL" label="SQL">```sql-create table countries (+create table orchestral_sections ("id" serial primary key,"name" text);-insert into countries+insert into orchestral_sections(id, name)values- (1, 'United Kingdom'),- (2, 'United States');+ (1, 'strings'),+ (2, 'woodwinds');-create table cities (+create table instruments ("id" serial primary key,"name" text,- "country_id" int references "countries"+ "section_id" int references "orchestral_sections");-insert into cities- (name, country_id)+insert into instruments+ (name, section_id)values- ('London', 1),- ('Manchester', 1),- ('Los Angeles', 2),- ('New York', 2);+ ('violin', 1),+ ('viola', 1),+ ('flute', 2),+ ('oboe', 2);```</TabPanel>@@ -80,10 +80,10 @@ The APIs will automatically detect relationships based on the foreign keys:<TabPanel id="js" label="JavaScript">```js-const { data, error } = await supabase.from('countries').select(`- id,- name,- cities ( id, name )+const { data, error } = await supabase.from('orchestral_sections').select(`+ id,+ name,+ instruments ( id, name )`)```@@ -93,66 +93,66 @@ const { data, error } = await supabase.from('countries').select(`These helper types provide the result types from any query, including nested types for database joins.-Given the following schema with a relation between cities and countries:+Given the following schema with a relation between orchestral sections and instruments:```sql-create table countries (+create table orchestral_sections ("id" serial primary key,"name" text);-create table cities (+create table instruments ("id" serial primary key,"name" text,- "country_id" int references "countries"+ "section_id" int references "orchestral_sections");```-We can get the nested `CountriesWithCities` type like this:+We can get the nested `SectionsWithInstruments` type like this:```tsimport { QueryResult, QueryData, QueryError } from '@supabase/supabase-js'-const countriesWithCitiesQuery = supabase.from('countries').select(`+const sectionsWithInstrumentsQuery = supabase.from('orchestral_sections').select(`id,name,- cities (+ instruments (id,name)`)-type CountriesWithCities = QueryData<typeof countriesWithCitiesQuery>+type SectionsWithInstruments = QueryData<typeof sectionsWithInstrumentsQuery>-const { data, error } = await countriesWithCitiesQuery+const { data, error } = await sectionsWithInstrumentsQueryif (error) throw error-const countriesWithCities: CountriesWithCities = data+const sectionsWithInstruments: SectionsWithInstruments = data```</TabPanel><TabPanel id="dart" label="Dart">```dart-final data = await supabase.from('countries').select('id, name, cities(id, name)');+final data = await supabase.from('orchestral_sections').select('id, name, instruments(id, name)');```</TabPanel><TabPanel id="swift" label="Swift">```swift-struct Country: Codable {+struct OrchestralSection: Codable {let id: Intlet name: String- let cities: [City]+ let instruments: [Instrument]- struct City: Codable {+ struct Instrument: Codable {let id: Intlet name: String}}-let countries: [Country] = try await supabase- .from("countries")- .select("id, name, cities(id, name)")+let orchestralSections: [OrchestralSection] = try await supabase+ .from("orchestral_sections")+ .select("id, name, instruments(id, name)").execute().value```@@ -161,14 +161,14 @@ let countries: [Country] = try await supabase<TabPanel id="kotlin" label="Kotlin">```kotlin-val data = supabase.from("countries").select(Columns.raw("id, name, cities(id, name)"))+val data = supabase.from("orchestral_sections").select(Columns.raw("id, name, instruments(id, name)"))```</TabPanel><TabPanel id="python" label="Python">```python-data = supabase.from_('countries').select('id, name, cities(id, name)').execute()+data = supabase.from_('orchestral_sections').select('id, name, instruments(id, name)').execute()```</TabPanel>@@ -177,13 +177,13 @@ data = supabase.from_('countries').select('id, name, cities(id, name)').execute(```javascriptconst Query = `query {- countriesCollection {+ orchestral_sectionsCollection {edges {node {id- name- cities {- id,+ name+ instruments {+ id,name}}@@ -197,7 +197,7 @@ const Query = `<TabPanel id="url" label="URL">```bash-GET https://[REF].supabase.co/rest/v1/countries?select=id,name,cities(id,name)+GET https://[REF].supabase.co/rest/v1/orchestral_sections?select=id,name,instruments(id,name)```</TabPanel>@@ -238,8 +238,8 @@ In these cases you don't need to explicitly define the joining table (members).```jsconst { data, error } = await supabase.from('teams').select(`- id,- team_name,+ id,+ team_name,users ( id, name )`)```@@ -387,7 +387,7 @@ const { data, error } = await supabase.from('shifts').select(badge_scan_time),end_scan:scans!scan_id_end (- id,+ id,user_id,badge_scan_time)diff --git a/apps/docs/content/guides/getting-started/quickstarts/redwoodjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/redwoodjs.mdxindex 025a22e5ba2..2ca3ceee5a9 100644--- a/apps/docs/content/guides/getting-started/quickstarts/redwoodjs.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/redwoodjs.mdx@@ -128,13 +128,13 @@ hideToc: true</StepHikeCompact.Step><StepHikeCompact.Step step={7}>- <StepHikeCompact.Details title="Create the Country model and apply a schema migration">- Create the Country model in `api/db/schema.prisma` and then run `yarn rw prisma migrate dev` from your terminal to apply the migration.+ <StepHikeCompact.Details title="Create the Instrument model and apply a schema migration">+ Create the Instrument model in `api/db/schema.prisma` and then run `yarn rw prisma migrate dev` from your terminal to apply the migration.</StepHikeCompact.Details><StepHikeCompact.Code>```prisma api/db/schema.prisma- model Country {+ model Instrument {id Int @id @default(autoincrement())name String @unique}@@ -145,7 +145,7 @@ hideToc: true<StepHikeCompact.Step step={8}><StepHikeCompact.Details title="Update seed script">- Let's seed the database with a few countries.+ Let's seed the database with a few instruments.Update the file `scripts/seeds.ts` to contain the following code:</StepHikeCompact.Details>@@ -158,17 +158,17 @@ hideToc: trueexport default async () => {try {- const data: Prisma.CountryCreateArgs['data'][] = [- { name: 'United States' },- { name: 'Canada' },- { name: 'Mexico' },+ const data: Prisma.InstrumentCreateArgs['data'][] = [+ { name: 'dulcimer' },+ { name: 'harp' },+ { name: 'guitar' },]- console.log('Seeding countries ...')+ console.log('Seeding instruments ...')- const countries = await db.country.createMany({ data })+ const instruments = await db.instrument.createMany({ data })- console.log('Done.', countries)+ console.log('Done.', instruments)} catch (error) {console.error(error)}@@ -180,7 +180,7 @@ hideToc: true<StepHikeCompact.Step step={9}><StepHikeCompact.Details title="Seed your database">- Run the seed database command to populate the `Country` table with the countries you just created.+ Run the seed database command to populate the `Instrument` table with the instruments you just created.<Admonition type="tip">@@ -198,13 +198,13 @@ hideToc: true</StepHikeCompact.Step><StepHikeCompact.Step step={10}>- <StepHikeCompact.Details title="Scaffold the Country UI">- Now, we'll use RedwoodJS generators to scaffold a CRUD UI for the `Country` model.+ <StepHikeCompact.Details title="Scaffold the Instrument UI">+ Now, we'll use RedwoodJS generators to scaffold a CRUD UI for the `Instrument` model.</StepHikeCompact.Details><StepHikeCompact.Code>```bash Terminal- yarn rw g scaffold country+ yarn rw g scaffold instrument```</StepHikeCompact.Code>@@ -223,15 +223,11 @@ hideToc: true</StepHikeCompact.Step><StepHikeCompact.Step step={12}>- <StepHikeCompact.Details title="View Countries UI">- Click on `/countries` to visit http://localhost:8910/countries where should see the list of countries.+ <StepHikeCompact.Details title="View Books UI">+ Click on `/instruments` to visit http://localhost:8910/instruments where should see the list of instruments.- You may now edit, delete, and add new countries using the scaffolded UI.+ You may now edit, delete, and add new books using the scaffolded UI.</StepHikeCompact.Details>- <StepHikeCompact.Code>- - </StepHikeCompact.Code>-</StepHikeCompact.Step></StepHikeCompact>diff --git a/apps/docs/content/guides/getting-started/quickstarts/refine.mdx b/apps/docs/content/guides/getting-started/quickstarts/refine.mdxindex b039f19a5cb..c8dc79291fe 100644--- a/apps/docs/content/guides/getting-started/quickstarts/refine.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/refine.mdx@@ -8,7 +8,7 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>-+<QuickstartDbSetup /></StepHikeCompact.Step>@@ -219,9 +219,5 @@ hideToc: trueThe Inferencer auto-generated code gives you a good starting point on which to keep building your `list`, `create`, `show` and `edit` pages. They can be obtained by clicking the `Show the auto-generated code` buttons in their respective pages.</StepHikeCompact.Details>- <StepHikeCompact.Code>- - </StepHikeCompact.Code>-</StepHikeCompact.Step></StepHikeCompact>diff --git a/apps/docs/spec/examples/examples.yml b/apps/docs/spec/examples/examples.ymldeleted file mode 100644index ace8173ecb1..00000000000--- a/apps/docs/spec/examples/examples.yml+++ /dev/null@@ -1,5675 +0,0 @@-openref: 0.1--info:- id: reference/supabase-js- title: Supabase Client- description: |-- Supabase JavaScript.-- definition: ../../spec/enrichments/tsdoc_v2/combined.json- specUrl: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2.yml- slugPrefix: '/'- libraries:- - id: 'JavaScript'- version: '0.0.1'--functions:- - id: initializing- $ref: '@supabase/supabase-js.index.SupabaseClient.constructor'- description: |- You can initialize a new Supabase client using the `createClient()` method.-- The Supabase client is your entrypoint to the rest of the Supabase functionality- and is the easiest way to interact with everything we offer within the Supabase ecosystem.-- examples:- - id: create-client- name: createClient()- js: |- ```js- import { createClient } from '@supabase/supabase-js'-- // Create a single supabase client for interacting with your database- const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')- ```- response: |- {- "hello":"world"- }- - id: with-additional-parameters- name: With additional parameters- js: |- ```js- import { createClient } from '@supabase/supabase-js'-- const options = {- db: {- schema: 'public',- },- auth: {- autoRefreshToken: true,- persistSession: true,- detectSessionInUrl: true- },- global: {- headers: { 'x-my-custom-header': 'my-app-name' },- },- }- const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key", options)- ```- response: |- {- "hello":"jonny"- }- - id: api-schemas- name: API schemas- js: |- ```js- import { createClient } from '@supabase/supabase-js'-- // Provide a custom schema. Defaults to "public".- const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {- db: { schema: 'other_schema' }- })- ```-- By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard.- Go to `Settings > API > Schema` and add the schema which you want to expose to the API.-- Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema.- - id: custom-fetch-implementation- name: Custom `fetch` implementation- js: |- ```js- import { createClient } from '@supabase/supabase-js'-- const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {- global: { fetch: fetch.bind(globalThis) }- })- ```-- `supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests,- but an alternative `fetch` implementation can be provided as an option.- This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers).- - id: react-native-options- name: React Native options- js: |- ```js- import 'react-native-url-polyfill/auto'- import { createClient } from '@supabase/supabase-js'- import AsyncStorage from "@react-native-async-storage/async-storage";-- const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key", {- auth: {- storage: AsyncStorage,- autoRefreshToken: true,- persistSession: true,- detectSessionInUrl: false,- },- });- ```-- For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth.- - id: auth.signUp()- title: 'signUp()'- $ref: '@supabase/gotrue-js.GoTrueClient.signUp'- notes: |- - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://supabase.com/dashboard/project/_/auth/providers).- - **Confirm email** determines if users need to confirm their email address after signing up.- - If **Confirm email** is enabled, a `user` is returned but `session` is null.- - If **Confirm email** is disabled, both a `user` and a `session` are returned.- - By default, when the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/guides/auth/redirect-urls). You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://supabase.com/dashboard/project/_/auth/url-configuration).- - If signUp() is called for an existing confirmed user:- - When both **Confirm email** and **Confirm phone** (even when phone provider is disabled) are enabled in [your project](/dashboard/project/_/auth/providers), an obfuscated/fake user object is returned.- - When either **Confirm email** or **Confirm phone** (even when phone provider is disabled) is disabled, the error message, `User already registered` is returned.- - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser).- examples:- - id: sign-up.- name: Sign up.- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.signUp({- email: '[email protected]',- password: 'example-password',- })- ```- - id: sign-up-with-additional-user-metadata.- name: Sign up with additional user metadata.- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.signUp(- {- email: '[email protected]',- password: 'example-password',- options: {- data: {- first_name: 'John',- age: 27,- }- }- }- )- ```- - id: auth.signInWithPassword()- title: 'signInWithPassword()'- $ref: '@supabase/gotrue-js.GoTrueClient.signInWithPassword'- notes: |- - Requires either an email and password or a phone number and password.- examples:- - id: sign-in-with-email-and-password- name: Sign in with email and password- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.signInWithPassword({- email: '[email protected]',- password: 'example-password',- })- ```- - id: sign-in-with-phone-and-password- name: Sign in with phone and password- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.signInWithPassword({- phone: '+13334445555',- password: 'some-password',- })-- // After receiving a SMS with a OTP.- const { data, error } = await supabase.auth.verifyOtp({- phone: '+13334445555',- token: '123456',- })- ```- - id: auth.signInWithOtp()- title: 'signInWithOtp()'- $ref: '@supabase/gotrue-js.GoTrueClient.signInWithOtp'- notes: |- - Requires either an email or phone number.- - This method is used for passwordless sign-ins where a OTP is sent to the user's email or phone number.- - If you're using an email, you can configure whether you want the user to receive a magiclink or a OTP.- - If you're using phone, you can configure whether you want the user to receive a OTP.- - The magic link's destination URL is determined by the [`SITE_URL`](https://supabase.com/docs/guides/auth/redirect-urls). You can modify the `SITE_URL` or add additional redirect URLs in [your project](https://supabase.com/dashboard/project/_/auth/url-configuration).- - If you are looking to send your own OTP emails, you can use the [Auth Admin command](https://supabase.com/docs/reference/javascript/auth-admin-generatelink) or the `Send Email` [Auth Hook](https://supabase.com/docs/guides/auth/auth-hooks)- examples:- - id: sign-in-with-email.- name: Sign in with email.- isSpotlight: true- description: The user will be sent an email which contains either a magiclink or a OTP or both. By default, a given user can only request a OTP once every 60 seconds.- js: |- ```js- const { data, error } = await supabase.auth.signInWithOtp({- email: '[email protected]',- })- ```- - id: sign-in-with-sms-otp.- name: Sign in with SMS OTP.- isSpotlight: false- description: The user will be sent a SMS which contains a OTP. By default, a given user can only request a OTP once every 60 seconds.- js: |- ```js- const { data, error } = await supabase.auth.signInWithOtp({- phone: '+13334445555',- })- ```- - id: auth.signInWithOAuth()- title: 'signInWithOAuth()'- $ref: '@supabase/gotrue-js.GoTrueClient.signInWithOAuth'- notes: |- - This method is used for signing in using a third-party provider.- - Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).- examples:- - id: sign-in-using-a-third-party-provider- name: Sign in using a third-party provider-- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.signInWithOAuth({- provider: 'github'- })- ```- - id: sign-in-using-a-third-party-provider-with-redirect- name: Sign in using a third-party provider with redirect- isSpotlight: false- description: |- When the third-party provider successfully authenticates the user, the provider will redirect the user to the URL specified in the `redirectTo` parameter. This parameter defaults to the [`SITE_URL`](https://supabase.com/docs/guides/auth/redirect-urls). It does not redirect the user immediately after invoking this method.- You can modify the `SITE_URL` or add additional redirect URLs in [your project](https://supabase.com/dashboard/project/_/auth/url-configuration).- js: |- ```js- const { data, error } = await supabase.auth.signInWithOAuth({- provider: 'github',- options: {- redirectTo: 'https://example.com/welcome'- }- })- ```- - id: sign-in-with-scopes- name: Sign in with scopes- isSpotlight: false- description: |- If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token.- You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider. The list of scopes will be documented by the third-party provider you are using and specifying scopes will enable you to use the OAuth provider token to call additional APIs supported by the third-party provider to get more information.- js: |- ```js- const { data, error } = await supabase.auth.signInWithOAuth({- provider: 'github',- options: {- scopes: 'repo gist notifications'- }- })- const oAuthToken = data.session.provider_token // use to access provider API- ```- - id: auth.signOut()- title: 'signOut()'- $ref: '@supabase/gotrue-js.GoTrueClient.signOut'- notes: |- - In order to use the `signOut()` method, the user needs to be signed in first.- examples:- - id: sign-out- name: Sign out- isSpotlight: true- js: |- ```js- const { error } = await supabase.auth.signOut()- ```- - id: auth.verifyOtp()- title: 'verifyOtp()'- $ref: '@supabase/gotrue-js.GoTrueClient.verifyOtp'- notes: |- - The `verifyOtp` method takes in different verification types. If a phone number is used, the type can either be `sms` or `phone_change`. If an email address is used, the type can be one of the following: `signup`, `magiclink`, `recovery`, `invite` or `email_change`.- - The verification type used should be determined based on the corresponding auth method called before `verifyOtp` to sign up / sign-in a user.- examples:- - id: verify-sms-one-time-password(otp)- name: Verify Sms One-Time Password (OTP)- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.verifyOtp({ phone, token, type: 'sms'})- ```- - id: verify-signup-one-time-password(otp)- name: Verify Signup One-Time Password (OTP)- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.verifyOtp({ email, token, type: 'signup'})- ```- - id: verify-email-auth(tokenhash)- name: Verify Email Auth (Token Hash)- isSpotlight: false- code: |- ```js- const { data, error } = await supabase.auth.verifyOtp({ token_hash: tokenHash, type: 'email'})- ```- - id: auth.getSession()- title: 'getSession()'- $ref: '@supabase/gotrue-js.GoTrueClient.getSession'- examples:- - id: get-the-session-data- name: Get the session data- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.getSession()- ```- - id: auth.getUser()- title: 'getUser()'- $ref: '@supabase/gotrue-js.GoTrueClient.getUser'- notes: |- - This method gets the user object from the current session.- - Fetches the user object from the database instead of local session.- examples:- - id: get-the-logged-in-user-with-the-current-existing-session- name: Get the logged in user with the current existing session- isSpotlight: true- js: |- ```js- const { data: { user } } = await supabase.auth.getUser()- ```- - id: get-the-logged-in-user-with-a-custom-access-token-jwt- name: Get the logged in user with a custom access token jwt.- isSpotlight: false- js: |- ```js- const { data: { user } } = await supabase.auth.getUser(jwt)- ```- - id: auth.updateUser()- title: 'updateUser()'- $ref: '@supabase/gotrue-js.GoTrueClient.updateUser'- notes: |- - In order to use the `updateUser()` method, the user needs to be signed in first.- - By Default, email updates sends a confirmation link to both the user's current and new email.- To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://supabase.com/dashboard/project/_/auth/providers).- examples:- - id: update-the-email-for-an-authenticated-user- name: Update the email for an authenticated user- description: Sends a "Confirm Email Change" email to the new email address.- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.updateUser({email: '[email protected]'})- ```- - id: update-the-password-for-an-authenticated-user- name: Update the password for an authenticated user- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.updateUser({password: 'new password'})- ```- - id: update-the-user's-metadata- name: Update the user's metadata- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.updateUser({- data: { hello: 'world' }- })- ```- - id: auth.setSession()- title: 'setSession()'- $ref: '@supabase/gotrue-js.GoTrueClient.setSession'- notes: |- - `setSession()` takes in a refresh token and uses it to get a new session.- - The refresh token can only be used once to obtain a new session.- - [Refresh token rotation](/docs/reference/auth/config#refresh_token_rotation_enabled) is enabled by default on all projects to guard against replay attacks.- - You can configure the [`REFRESH_TOKEN_REUSE_INTERVAL`](https://supabase.com/docs/reference/auth/config#refresh_token_reuse_interval) which provides a short window in which the same refresh token can be used multiple times in the event of concurrency or offline issues.- examples:- - id: refresh-the-session- name: Refresh the session- description: Sets the session data from refresh_token and returns current session or an error if the refresh_token is invalid.- isSpotlight: true- js: |- ```js- const { data, error } = supabase.auth.setSession(refresh_token)- ```- - id: auth.refreshSession()- title: 'refreshSession()'- $ref: '@supabase/gotrue-js.GoTrueClient.refreshSession'- notes: |- - This method will refresh the session whether the current one is expired or not.- - Both examples destructure `user` and `session` from `data`. This is not required; so `const { data, error } =` is also valid.- examples:- - id: refresh-session-using-the-current-session- name: Refresh session using the current session- isSpotlight: true- js: |- ```js- const { data: { user, session }, error } = await supabase.auth.refreshSession()- ```- - id: refresh-session-using-a-passed-in-session- name: Refresh session using a passed-in session- isSpotlight: true- js: |- ```js- const { data: { user, session }, error } = await supabase.auth.refreshSession({ refresh_token })- ```- - id: auth.onAuthStateChange()- title: 'onAuthStateChange()'- $ref: '@supabase/gotrue-js.GoTrueClient.onAuthStateChange'- notes: |- - Types of auth events: `SIGNED_IN`, `SIGNED_OUT`, `TOKEN_REFRESHED`, `USER_UPDATED`, `USER_DELETED`, `PASSWORD_RECOVERY`- examples:- - id: listen-to-auth-changes- name: Listen to auth changes- isSpotlight: true- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- console.log(event, session)- })- ```- - id: listen-to-sign-in- name: Listen to sign in- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'SIGNED_IN') console.log('SIGNED_IN', session)- })- ```- - id: listen-to-sign-out- name: Listen to sign out- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'SIGNED_OUT') console.log('SIGNED_OUT', session)- })- ```- - id: listen-to-token-refresh- name: Listen to token refresh- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'TOKEN_REFRESHED') console.log('TOKEN_REFRESHED', session)- })- ```- - id: listen-to-user-updates- name: Listen to user updates- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'USER_UPDATED') console.log('USER_UPDATED', session)- })- ```- - id: listen-to-user-deleted- name: Listen to user deleted- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'USER_DELETED') console.log('USER_DELETED', session)- })- ```- - id: listen-to-password-recovery-events- name: Listen to password recovery events- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'PASSWORD_RECOVERY') console.log('PASSWORD_RECOVERY', session)- })- ```- - id: Supabase Auth Admin Api- title: 'Overview'- notes: |- - Any method under the `supabase.auth.admin` namespace requires a `service_role` key.- - These methods are considered admin methods and should be called on a trusted server. Never expose your `service_role` key in the browser.-- - id: auth.admin.getUserById()- title: 'getUserById()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.getUserById'- notes: |- - Fetches the user object from the database based on the user's id.- - The `getUserById()` method requires the user's id which maps to the `auth.users.id` column.- examples:- - id: fetch-the-user-object-using-the-access-token-jwt- name: Fetch the user object using the access_token jwt.- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.admin.getUserById(1)- ```-- - id: auth.admin.listUsers()- title: 'listUsers()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.listUsers'- examples:- - id: get-a-full-list-of-users.- name: Get a full list of users.- isSpotlight: true- js: |- ```js- const { data: { users }, error } = await supabase.auth.admin.listUsers()- ```- - id: auth.admin.createUser()- title: 'createUser()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.createUser'- notes: |- - To confirm the user's email address or phone number, set `email_confirm` or `phone_confirm` to true. Both arguments default to false.- examples:- - id: create-a-new-user-with-custom-user-metadata- name: Create a new user with custom user metadata- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.admin.createUser({- email: '[email protected]',- password: 'password',- user_metadata: { name: 'Yoda' }- })- ```- - id: auto-confirm-the-user's-email- name: Auto-confirm the user's email- js: |- ```js- const { data, error } = await supabase.auth.admin.createUser({- email: '[email protected]',- email_confirm: true- })- ```- - id: auto-confirm-the-user's-phone-number- name: Auto-confirm the user's phone number- js: |- ```js- const { data, error } = await supabase.auth.admin.createUser({- phone: '1234567890',- phone_confirm: true- })- ```- - id: auth.admin.deleteUser()- title: 'deleteUser()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.deleteUser'- notes: |- - The `deleteUser()` method requires the user's ID, which maps to the `auth.users.id` column.- examples:- - id: removes-a-user- name: Removes a user- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.admin.deleteUser(- '715ed5db-f090-4b8c-a067-640ecee36aa0'- )- ```-- - id: auth.admin.inviteUserByEmail()- title: 'inviteUserByEmail()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.inviteUserByEmail'- notes: |- - Sends an invite link to the user's email address.- examples:- - id: invite-a-user- name: Invite a user- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.admin.inviteUserByEmail('[email protected]')- ```-- - id: auth.resetPasswordForEmail()- title: 'resetPasswordForEmail()'- $ref: '@supabase/gotrue-js.GoTrueClient.resetPasswordForEmail'- notes: |- Sends a password reset request to an email address.- When the user clicks the reset link in the email they are redirected back to your application.- Prompt the user for a new password and call `auth.updateUser()`:- ```js- const { data, error } = await supabase.auth- .updateUser({ password: new_password })- ```- examples:- - id: reset-password- name: Reset password- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.resetPasswordForEmail(email, {- redirectTo: 'https://example.com/update-password',- })- ```- - id: reset-password(react)- name: Reset password (React)- isSpotlight: true- js: |- ```js- /**- * Step 1: Send the user an email to get a password reset token.- * This email contains a link which sends the user back to your application.- */- const { data, error } = await supabase.auth- .resetPasswordForEmail('[email protected]')-- /**- * Step 2: Once the user is redirected back to your application,- * ask the user to reset their password.- */- useEffect(() => {- supabase.auth.onAuthStateChange(async (event, session) => {- if (event == "PASSWORD_RECOVERY") {- const newPassword = prompt("What would you like your new password to be?");- const { data, error } = await supabase.auth- .updateUser({ password: newPassword })-- if (data) alert("Password updated successfully!")- if (error) alert("There was an error updating your password.")- }- })- }, [])- ```-- - id: auth.admin.generateLink()- title: 'generateLink()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.generateLink'- examples:- - id: generate-a-signup-link- name: Generate a signup link- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.admin.generateLink({- type: 'signup',- email: '[email protected]',- options: {- 'password': 'secret'- }- })- ```- - id: generate-an-invite-link- name: Generate an invite link- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.admin.generateLink({- type: 'invite',- email: '[email protected]'- })- ```- - id: generate-a-magic-link- name: Generate a magic link- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.admin.generateLink({- type: 'magiclink',- email: '[email protected]'- })- ```- - id: generate-a-recovery-link- name: Generate a recovery link- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.admin.generateLink({- type: 'recovery',- email: '[email protected]'- })- ```- - id: generate-links-to-change-current-email-address- name: Generate links to change current email address- isSpotlight: false- js: |- ```js- // generate an email change link to be sent to the current email address- const { data, error } = await supabase.auth.admin.generateLink({- type: 'email_change_current',- email: '[email protected]',- newEmail: '[email protected]'- })-- // generate an email change link to be sent to the new email address- const { data, error } = await supabase.auth.admin.generateLink({- type: 'email_change_new',- email: '[email protected]',- newEmail: '[email protected]'- })- ```-- - id: auth.admin.updateUserById()- title: 'updateUserById()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.updateUserById'- examples:- - id: updates-a-users-email.- name: Updates a user's email.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { email: '[email protected]' }- )- ```- - id: updates-a-users-password.- name: Updates a user's password.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { password: 'new_password' }- )- ```- - id: updates-a-users-metadata.- name: Updates a user's metadata.- isSpotlight: true- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { user_metadata: { hello: 'world' } }- )- ```- - id: updates-a-users-app-metadata.- name: Updates a user's app_metadata.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { app_metadata: { plan: 'trial' } }- )- ```- - id: confirms-a-users-email-address.- name: Confirms a user's email address.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { email_confirm: true }- )- ```- - id: confirms-a-users-phone-number.- name: Confirms a user's phone number.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { phone_confirm: true }- )- ```-- - id: select()- title: 'Fetching data'- description: 'This is the description'- $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.select'- notes: |- - By default, Supabase projects return a maximum of 1,000 rows. This setting can be changed in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data.- - `select()` can be combined with [Filters](/docs/reference/javascript/using-filters)- - `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers)- - `apikey` is a reserved keyword if you're using the [Supabase Platform](/docs/guides/platform) and [should be avoided as a column name](https://github.com/supabase/supabase/issues/5465).- examples:- - id: getting-your-data- name: Getting your data- data:- sql: |- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- tables:- - schema: public- name: countries- content: |- | name | id |- | :-----------------------|------:|- | Afghanistan | 1 |- | Albania | 2 |- | Algeria | 3 |- response: |- {- "data": [- {- "id": 1,- "name": "Afghanistan"- },- {- "id": 2,- "name": "Albania"- },- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- - id: selecting-specific-columns- name: Selecting specific columns- description: |- You can select specific fields from your tables.- data:- sql: |- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- tables:- - schema: public- name: countries- content: |- | name | id |- | :-----------------------|------:|- | Afghanistan | 1 |- | Albania | 2 |- | Algeria | 3 |- response: |- {- "data": [- {- "name": "Afghanistan"- },- {- "name": "Albania"- },- {- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- hideCodeBlock: true- - id: query-foreign-tables- name: Query referenced tables- description: |- If your database has foreign key relationships, you can query related tables too.- code: |- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities (- name- )- `)- ```- data:- sql: |- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 2, 'Bali'),- (2, 1, 'Munich');- tables:- - schema: public- name: countries- content: |- | name | id |- | :-----------------------|------:|- | Germany | 1 |- | Indonesia | 2 |- - schema: public- name: cities- content: |- | name | id |- | :-----------------------|------:|- | Bali | 1 |- | Munich | 2 |- response: |- {- "data": [- {- "name": "Germany",- "cities": [- {- "name": "Munich"- }- ]- },- {- "name": "Indonesia",- "cities": [- {- "name": "Bali"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }-- - id: query-foreign-tables-through-a-join-table- name: Query referenced tables through a join table- data:- sql: |- create table- users (- id int8 primary key,- name text- );- create table- teams (- id int8 primary key,- name text- );- -- join table- create table- users_teams (- user_id int8 not null references users,- team_id int8 not null references teams,- -- both foreign keys must be part of a composite primary key- primary key (user_id, team_id)- );-- insert into- users (id, name)- values- (1, 'Kiran'),- (2, 'Evan');- insert into- teams (id, name)- values- (1, 'Green'),- (2, 'Blue');- insert into- users_teams (user_id, team_id)- values- (1, 1),- (1, 2),- (2, 2);- response: |- {- "data": [- {- "name": "Kiran",- "teams": [- {- "name": "Green"- },- {- "name": "Blue"- }- ]- },- {- "name": "Evan",- "teams": [- {- "name": "Blue"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- description: |- If you're in a situation where your tables are **NOT** directly- related, but instead are joined by a _join table_, you can still use- the `select()` method to query the related data. The join table needs- to have the foreign keys as part of its composite primary key.- code: |- ```ts- const { data, error } = await supabase- .from('users')- .select(`- name,- teams (- name- )- `)- ```- - id: query-the-same-foreign-table-multiple-times- name: Query the same referenced table multiple times- description: |- If you need to query the same referenced table twice, use the name of the- joined column to identify which join to use. You can also give each- column an alias.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (id int8 primary key, name text);-- create table- messages (- sender_id int8 not null references users,- receiver_id int8 not null references users,- content text- );-- insert into- users (id, name)- values- (1, 'Kiran'),- (2, 'Evan');-- insert into- messages (sender_id, receiver_id, content)- values- (1, 2, '👋');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('messages')- .select(`- content,- from:sender_id(name),- to:receiver_id(name)- `)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "content": "👋",- "from": {- "name": "Kiran"- },- "to": {- "name": "Evan"- }- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: query-nested-foreign-tables-through-a-join-table- name: Query nested foreign tables through a join table- code: |- ```ts- const { data, error } = await supabase- .from('games')- .select(`- game_id:id,- away_team:teams!games_away_team_fkey (- users (- id,- name- )- )- `)- ```- data:- sql: |- ```sql- create table- users (- id int8 primary key,- name text- );- create table- teams (- id int8 primary key,- name text- );- -- join table- create table- users_teams (- user_id int8 not null references users,- team_id int8 not null references teams,-- primary key (user_id, team_id)- );- create table- games (- id int8 primary key,- home_team int8 not null references teams,- away_team int8 not null references teams,- name text- );-- insert into users (id, name)- values- (1, 'Kiran'),- (2, 'Evan');- insert into- teams (id, name)- values- (1, 'Green'),- (2, 'Blue');- insert into- users_teams (user_id, team_id)- values- (1, 1),- (1, 2),- (2, 2);- insert into- games (id, home_team, away_team, name)- values- (1, 1, 2, 'Green vs Blue'),- (2, 2, 1, 'Blue vs Green');- ```- response: |- ```json- {- "data": [- {- "game_id": 1,- "away_team": {- "users": [- {- "id": 1,- "name": "Kiran"- },- {- "id": 2,- "name": "Evan"- }- ]- }- },- {- "game_id": 2,- "away_team": {- "users": [- {- "id": 1,- "name": "Kiran"- }- ]- }- }- ],- "status": 200,- "statusText": "OK"- }- ```- description: |- You can use the result of a joined table to gather data in- another foreign table. With multiple references to the same foreign- table you must specify the column on which to conduct the join.- hideCodeBlock: true- - id: filtering-through-foreign-tables- name: Filtering through referenced tables- description: |- If the filter on a referenced table's column is not satisfied, the referenced- table returns `[]` or `null` but the parent table is not filtered out.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 2, 'Bali'),- (2, 1, 'Munich');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('cities')- .select('name, countries(*)')- .eq('countries.name', 'Estonia')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Bali",- "countries": null- },- {- "name": "Munich",- "countries": null- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>-- If you want to filter out the parent table rows, use the `!inner` hint:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('cities')- .select('name, countries!inner(*)')- .eq('countries.name', 'Estonia')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: querying-with-count-option- name: Querying with count option- description: |- You can get the number of rows by using the- [count](/docs/reference/javascript/select#parameters) option. For- example, to get the table count without returning all rows:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { count, error } = await supabase- .from('countries')- .select('*', { count: 'exact', head: true })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "count": 3,- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: querying-json-data- name: Querying JSON data- description: |- You can select and filter data inside of- [JSON](/docs/guides/database/json) columns. Postgres offers some- [operators](/docs/guides/database/json#query-the-jsonb-data) for- querying JSON data.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text,- address jsonb- );-- insert into- users (id, name, address)- values- (1, 'Avdotya', '{"city":"Saint Petersburg"}');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .select(`- id, name,- address->city- `)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Avdotya",- "city": "Saint Petersburg"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- - id: insert()- title: 'Create data: insert()'- $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.insert'- examples:- - id: create-a-record- name: Create a record- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { error } = await supabase- .from('countries')- .insert({ id: 1, name: 'Denmark' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "status": 201,- "statusText": "Created"- }- ```- </TabPanel>- </Tabs>-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Denmark"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { error } = await supabase- .from('countries')- .insert({ id: 1, name: 'Denmark' })- ```- - id: create-a-record-and-return-it- name: Create a record and return it- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .insert({ id: 1, name: 'Denmark' })- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Denmark"- }- ],- "status": 201,- "statusText": "Created"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: bulk-create- name: Bulk create- description: |- A bulk create operation is handled in a single transaction.- If any of the inserts fail, none of the rows are inserted.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { error } = await supabase- .from('countries')- .insert([- { id: 1, name: 'Nepal' },- { id: 1, name: 'Vietnam' },- ])- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "error": {- "code": "23505",- "details": "Key (id)=(1) already exists.",- "hint": null,- "message": "duplicate key value violates unique constraint \"countries_pkey\""- },- "status": 409,- "statusText": "Conflict"- }- ```-- </TabPanel>- </Tabs>-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- - id: update()- title: 'Modify data: update()'- $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.update'- notes: |- - `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update.- examples:- - id: updating-your-data- name: Updating your data- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Taiwan');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { error } = await supabase- .from('countries')- .update({ name: 'Australia' })- .eq('id', 1)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "status": 204,- "statusText": "No Content"- }- ```-- </TabPanel>- </Tabs>-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Australia"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { error } = await supabase- .from('countries')- .update({ name: 'Australia' })- .eq('id', 1)- ```- - id: update-a-record-and-return-it- name: Update a record and return it- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Taiwan');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .update({ name: 'Australia' })- .eq('id', 1)- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Australia"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: updating-json-data- name: Updating JSON data- description: |- Postgres offers some- [operators](/docs/guides/database/json#query-the-jsonb-data) for- working with JSON data.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text,- address jsonb- );-- insert into- users (id, name, address)- values- (1, 'Michael', '{ "postcode": 90210 }');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .update({- address: {- street: 'Melrose Place',- postcode: 90210- }- })- .eq('address->postcode', 90210)- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Michael",- "address": {- "street": "Melrose Place",- "postcode": 90210- }- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>-- Currently, it is only possible to update the entire JSON document.- hideCodeBlock: true-- - id: upsert()- title: 'Upsert data: upsert()'- $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.upsert'- notes: |- - Primary keys must be included in `values` to use upsert.- examples:- - id: upsert-your-data- name: Upsert your data- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Albania' })- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Albania"- }- ],- "status": 201,- "statusText": "Created"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Albania' })- .select()- ```- - id: bulk-upsert-your-data- name: Bulk Upsert your data- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .upsert([- { id: 1, name: 'Albania' },- { id: 2, name: 'Algeria' },- ])- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Albania"- },- {- "id": 2,- "name": "Algeria"- }- ],- "status": 201,- "statusText": "Created"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: upserting-into-tables-with-constraints- name: Upserting into tables with constraints- description: |- In the following query, `upsert()` implicitly uses the `id`- (primary key) column to determine conflicts. If there is no existing- row with the same `id`, `upsert()` inserts a new row, which- will fail in this case as there is already a row with `handle` `"saoirse"`.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 generated by default as identity primary key,- handle text not null unique,- display_name text- );-- insert into- users (id, handle, display_name)- values- (1, 'saoirse', null);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' })- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "error": {- "code": "23505",- "details": "Key (handle)=(saoirse) already exists.",- "hint": null,- "message": "duplicate key value violates unique constraint \"users_handle_key\""- },- "status": 409,- "statusText": "Conflict"- }- ```-- </TabPanel>- </Tabs>-- Using the `onConflict` option, you can instruct `upsert()` to use- another column with a unique constraint to determine conflicts:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- await supabase- .from('users')- .upsert(- { id: 42, handle: 'saoirse', display_name: 'Saoirse' },- { onConflict: 'handle' },- )- const { data, error } = await supabase- .from('users')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 42,- "handle": "saoirse",- "display_name": "Saoirse"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- - id: delete()- title: 'Delete data: delete()'- $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.delete'- notes: |- - `delete()` should always be combined with [filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to delete.- - If you use `delete()` with filters and you have- [RLS](/docs/learn/auth-deep-dive/auth-row-level-security) enabled, only- rows visible through `SELECT` policies are deleted. Note that by default- no rows are visible, so you need at least one `SELECT`/`ALL` policy that- makes the rows visible.- examples:- - id: delete-records- name: Delete records- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Spain');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { error } = await supabase- .from('countries')- .delete()- .eq('id', 1)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "status": 204,- "statusText": "No Content"- }- ```-- </TabPanel>- </Tabs>-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { error } = await supabase- .from('countries')- .delete()- .eq('id', 1)- ```-- - id: rpc()- title: 'Postgres functions: rpc()'- description: |- You can call Postgres functions as _Remote Procedure Calls_, logic in your database that you can execute from anywhere.- Functions are useful when the logic rarely changes—like for password resets and updates.-- ```sql- create or replace function hello_world() returns text as $$- select 'Hello world';- $$ language sql;- ```- $ref: '@supabase/postgrest-js.PostgrestClient.rpc'- examples:- - id: call-a-postgres-function-without-arguments- name: Call a Postgres function without arguments- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create function hello_world() returns text as $$- select 'Hello world';- $$ language sql;- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase.rpc('hello_world')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": "Hello world",- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase.rpc('hello_world')- ```- - id: call-a-postgres-function-with-arguments- name: Call a Postgres function with arguments- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create function echo(say text) returns text as $$- select say;- $$ language sql;- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase.rpc('echo', { say: '👋' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": "👋",- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: bulk-processing- name: Bulk processing- description: |- You can process large payloads by passing in an array as an argument:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create function add_one_each(arr int[]) returns int[] as $$- select array_agg(n + 1) from unnest(arr) as n;- $$ language sql;- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase.rpc('add_one_each', { arr: [1, 2, 3] })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- 2,- 3,- 4- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: call-a-postgres-function-with-filters- name: Call a Postgres function with filters- description: |- Postgres functions that return tables can also be combined with- [Filters](/docs/reference/javascript/using-filters) and- [Modifiers](/docs/reference/javascript/using-modifiers).-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'France'),- (2, 'United Kingdom');-- create function list_stored_countries() returns setof countries as $$- select * from countries;- $$ language sql;- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .rpc('list_stored_countries')- .eq('id', 1)- .single()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": {- "id": 1,- "name": "France"- },- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- - id: Using Filters- description: |- Filters allow you to only return rows that match certain conditions.-- Filters can be used on `select()`, `update()`, `upsert()`, and `delete()` queries.-- If a Postgres function returns a table response, you can also apply filters.-- ### Applying Filters-- Filters must be applied after any of `select()`, `update()`, `upsert()`,- `delete()`, and `rpc()` and before- [modifiers](/docs/reference/javascript/using-modifiers).-- ```ts- const { data, error } = await supabase- .from('cities')- .select('name, country_id')- .eq('name', 'The Shire') // Correct-- const { data, error } = await supabase- .from('cities')- .eq('name', 'The Shire') // Incorrect- .select('name, country_id')- ```-- ### Chaining-- Filters can be chained together to produce advanced queries. For example,- to query cities with population between 1,000 and 10,000:-- ```ts- const { data, error } = await supabase- .from('cities')- .select('name, country_id')- .gte('population', 1000)- .lt('population', 10000)- ```-- ### Conditional Chaining-- Filters can be built up one step at a time and then executed. For example:-- ```ts- const filterByName = null- const filterPopLow = 1000- const filterPopHigh = 10000-- let query = supabase- .from('cities')- .select('name, country_id')-- if (filterByName) { query = query.eq('name', filterByName) }- if (filterPopLow) { query = query.gte('population', filterPopLow) }- if (filterPopHigh) { query = query.lt('population', filterPopHigh) }-- const { data, error } = await query- ```-- ### Filter by values within a JSON column-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text,- address jsonb- );-- insert into- users (id, name, address)- values- (1, 'Michael', '{ "postcode": 90210 }'),- (2, 'Jane', null);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .select()- .eq('address->postcode', 90210)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Michael",- "address": {- "postcode": 90210- }- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>-- ### Filter Referenced Tables-- You can filter on referenced tables in your `select()` query using dot- notation:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 2, 'Bali'),- (2, 1, 'Munich');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities!inner (- name- )- `)- .eq('cities.name', 'Bali')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Indonesia",- "cities": [- {- "name": "Bali"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>-- - id: eq()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.eq'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .eq('name', 'Albania')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .eq('name', 'Albania')- ```-- - id: neq()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.neq'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .neq('name', 'Albania')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Afghanistan"- },- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .neq('name', 'Albania')- ```-- - id: gt()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.gt'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .gt('id', 2)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .gt('id', 2)- ```-- - id: gte()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.gte'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .gte('id', 2)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": "Albania"- },- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .gte('id', 2)- ```-- - id: lt()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.lt'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .lt('id', 2)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Afghanistan"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .lt('id', 2)- ```-- - id: lte()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.lte'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .lte('id', 2)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Afghanistan"- },- {- "id": 2,- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .lte('id', 2)- ```-- - id: like()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.like'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .like('name', '%Alba%')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .like('name', '%Alba%')- ```-- - id: ilike()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.ilike'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .like('name', '%alba%')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .like('name', '%alba%')- ```-- - id: is()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.is'- examples:- - id: checking-nullness- name: Checking nullness- description: |- Using the `eq()` filter doesn't work when filtering for `null`:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'null'),- (2, null);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .eq('name', null)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "null"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>-- Instead, you need to use `is()`:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .is('name', null)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": null- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .is('name', null)- ```-- - id: in()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.in'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .in('name', ['Albania', 'Algeria'])- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": "Albania"- },- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .in('name', ['Albania', 'Algeria'])- ```-- - id: contains()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.contains'- examples:- - id: on-array-columns- name: On array columns- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- issues (- id int8 primary key,- title text,- tags text[]- );-- insert into- issues (id, title, tags)- values- (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']),- (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('issues')- .select('title')- .contains('tags', ['is:open', 'severity:high'])- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "title": "Cache invalidation is not working"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('users')- .select()- .contains('name', ['is:online', 'faction:red'])- ```- - id: on-range-columns- name: On range columns- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .contains('during', '[2000-01-01 13:00, 2000-01-01 13:30)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: on`jsonb`columns- name: On `jsonb` columns- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text,- address jsonb- );-- insert into- users (id, name, address)- values- (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'),- (2, 'Jane', '{}');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .select('name')- .contains('address', { postcode: 90210 })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Michael"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- - id: containedBy()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.containedBy'- examples:- - id: on-array-columns- name: On array columns- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- classes (- id int8 primary key,- name text,- days text[]- );-- insert into- classes (id, name, days)- values- (1, 'Chemistry', array['monday', 'friday']),- (2, 'History', array['monday', 'wednesday', 'thursday']);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('classes')- .select('name')- .containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday'])- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Chemistry"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('classes')- .select('name')- .containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday'])- ```- - id: on-range-columns- name: On range columns- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .containedBy('during', '[2000-01-01 00:00, 2000-01-01 23:59)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: on`jsonb`columns- name: On `jsonb` columns- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text,- address jsonb- );-- insert into- users (id, name, address)- values- (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'),- (2, 'Jane', '{}');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .select('name')- .containedBy('address', {})- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Jane"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- - id: rangeGt()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeGt'- examples:- - id: with`select()`- name: With `select()`- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "room_name": "Topaz",- "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)')- ```-- - id: rangeGte()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeGte'- examples:- - id: with`select()`- name: With `select()`- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "room_name": "Topaz",- "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)')- ```-- - id: rangeLt()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeLt'- examples:- - id: with`select()`- name: With `select()`- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)')- ```-- - id: rangeLte()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeLte'- examples:- - id: with`select()`- name: With `select()`- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)')- ```-- - id: rangeAdjacent()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeAdjacent'- examples:- - id: with`select()`- name: With `select()`- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)')- ```-- - id: overlaps()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.overlaps'- examples:- - id: on-array-columns- name: On array columns- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- issues (- id int8 primary key,- title text,- tags text[]- );-- insert into- issues (id, title, tags)- values- (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']),- (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('issues')- .select('title')- .overlaps('tags', ['is:closed', 'severity:high'])- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "title": "Cache invalidation is not working"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('issues')- .select('title')- .overlaps('tags', ['is:closed', 'severity:high'])- ```- - id: on-range-columns- name: On range columns- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .overlaps('during', '[2000-01-01 12:45, 2000-01-01 13:15)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- # TODO: schema & result- - id: textSearch()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.textSearch'- notes:- - For more information, see [Postgres full text search](/docs/guides/database/full-text-search).- examples:- - id: text-search- name: Text search- js: |- ```ts- const { data, error } = await supabase- .from('quotes')- .select('catchphrase')- .textSearch('catchphrase', `'fat' & 'cat'`, {- config: 'english'- })- ```- - id: basic-normalization- name: Basic normalization- description: Uses PostgreSQL's `plainto_tsquery` function.- js: |- ```ts- const { data, error } = await supabase- .from('quotes')- .select('catchphrase')- .textSearch('catchphrase', `'fat' & 'cat'`, {- type: 'plain',- config: 'english'- })- ```- - id: full-normalization- name: Full normalization- description: Uses PostgreSQL's `phraseto_tsquery` function.- js: |- ```ts- const { data, error } = await supabase- .from('quotes')- .select('catchphrase')- .textSearch('catchphrase', `'fat' & 'cat'`, {- type: 'phrase',- config: 'english'- })- ```- - id: websearch- name: Websearch- description: |- Uses PostgreSQL's `websearch_to_tsquery` function.- This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used- with advanced operators.-- - `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery.- - `"quoted text"`: text inside quote marks will be converted to terms separated by `<->` operators, as if processed by phraseto_tsquery.- - `OR`: the word “or” will be converted to the | operator.- - `-`: a dash will be converted to the ! operator.-- js: |- ```ts- const { data, error } = await supabase- .from('quotes')- .select('catchphrase')- .textSearch('catchphrase', `'fat or cat'`, {- type: 'websearch',- config: 'english'- })- ```-- - id: match()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.match'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .match({ id: 2, name: 'Albania' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .match({ id: 2, name: 'Albania' })- ```-- - id: not()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.not'- notes: |- not() expects you to use the raw PostgREST syntax for the filter values.-- ```ts- .not('id', 'in', '(5,6,7)') // Use `()` for `in` filter- .not('arraycol', 'cs', '{"a","b"}') // Use `cs` for `contains()`, `{}` for array values- ```- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'null'),- (2, null);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .not('name', 'is', null)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "null"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .not('name', 'is', null)- ```-- - id: or()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.or'- notes: |- or() expects you to use the raw PostgREST syntax for the filter names and values.-- ```ts- .or('id.in.(5,6,7), arraycol.cs.{"a","b"}') // Use `()` for `in` filter, `{}` for array values and `cs` for `contains()`.- .or('id.in.(5,6,7), arraycol.cd.{"a","b"}') // Use `cd` for `containedBy()`- ```- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .or('id.eq.2,name.eq.Algeria')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Albania"- },- {- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .or('id.eq.2,name.eq.Algeria')- ```- - id: use`or`with`and`- name: Use `or` with `and`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .or('id.gt.3,and(id.eq.1,name.eq.Afghanistan)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">--- ```json- {- "data": [- {- "name": "Afghanistan"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: use`or`on-foreign-tables- name: Use `or` on referenced tables- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 2, 'Bali'),- (2, 1, 'Munich');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities!inner (- name- )- `)- .or('country_id.eq.1,name.eq.Beijing', { foreignTable: 'cities' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Germany",- "cities": [- {- "name": "Munich"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- - id: filter()- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.filter'- notes: |- filter() expects you to use the raw PostgREST syntax for the filter values.-- ```ts- .filter('id', 'in', '(5,6,7)') // Use `()` for `in` filter- .filter('arraycol', 'cs', '{"a","b"}') // Use `cs` for `contains()`, `{}` for array values- ```- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .filter('name', 'in', '("Algeria","Japan")')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .filter('name', 'in', '("Algeria","Japan")')- ```- - id: on-a-foreign-table- name: On a referenced table- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 2, 'Bali'),- (2, 1, 'Munich');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities!inner (- name- )- `)- .filter('cities.name', 'eq', 'Bali')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Indonesia",- "cities": [- {- "name": "Bali"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities!inner (- name- )- `)- .filter('cities.name', 'eq', 'Bali')- ```-- - id: Using Modifiers- description: |- Filters work on the row level—they allow you to return rows that- only match certain conditions without changing the shape of the rows.- Modifiers are everything that don't fit that definition—allowing you to- change the format of the response (e.g., returning a CSV string).-- Modifiers must be specified after filters. Some modifiers only apply for- queries that return rows (e.g., `select()` or `rpc()` on a function that- returns a table response).-- - id: db.modifiers.select()- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.select'- title: select()- examples:- - id: with`upsert()`- name: With `upsert()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Albania' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "status": 201,- "statusText": "Created"- }- ```-- </TabPanel>- </Tabs>-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Algeria' })- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Algeria"- }- ],- "status": 201,- "statusText": "Created"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Algeria' })- .select()- ```-- - id: order()- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.order'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .order('name', { ascending: false })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 3,- "name": "Algeria"- },- {- "id": 2,- "name": "Albania"- },- {- "id": 1,- "name": "Afghanistan"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('cities')- .select('name', 'country_id')- .order('id', { ascending: false })- ```- - id: on-a-foreign-table- name: On a referenced table- description: |- Ordering on referenced tables doesn't affect the ordering of- the parent table.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'United States'),- (2, 'Vanuatu');- insert into- cities (id, country_id, name)- values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities (- name- )- `)- .order('name', { foreignTable: 'cities', ascending: false })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "United States",- "cities": [- {- "name": "New York City"- },- {- "name": "Atlanta"- }- ]- },- {- "name": "Vanuatu",- "cities": []- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - id: order-parent-table-by-a-referenced-table- name: Order parent table by a referenced table- code: |- ```ts- const { data, error } = await supabase- .from('cities')- .select(`- name,- country:countries (- name- )- `)- .order('country(name)', { ascending: true })- ```- data:- sql: |- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 1, 'Munich'),- (2, 1, 'Bali');- ```- response: |- ```json- {- "data": [- {- "name": "Munich",- "country": { "name": "Germany" }- },- {- "name": "Bali",- "country": { "name": "Indonesia" }- }- ],- "status": 200,- "statusText": "OK"- }- ```- description: |- Ordering with `referenced_table(col)` affects the ordering of the- parent table.- hideCodeBlock: true-- - id: limit()- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.limit'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .limit(1)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Afghanistan"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .limit(1)- ```- - id: on-a-foreign-table- name: On a referenced table- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'United States');- insert into- cities (id, country_id, name)- values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities (- name- )- `)- .limit(1, { foreignTable: 'cities' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "United States",- "cities": [- {- "name": "Atlanta"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- - id: range()- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.range'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .range(0, 1)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Afghanistan"- },- {- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .range(0, 1)- ```-- - id: db.abortSignal()- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.abortSignal'- title: abortSignal()- examples:- - id: aborting-requests-in-flight- name: Aborting requests in-flight- description: |- You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. Note that `status` and `statusText` don't mean anything for aborted requests as the request wasn't fulfilled.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const ac = new AbortController()- ac.abort()- const { data, error } = await supabase- .from('very_big_table')- .select()- .abortSignal(ac.signal)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "error": {- "message": "FetchError: The user aborted a request.",- "details": "",- "hint": "",- "code": ""- },- "status": 400,- "statusText": "Bad Request"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const ac = new AbortController()- ac.abort()- const { data, error } = await supabase- .from('very_big_table')- .select()- .abortSignal(ac.signal)- ```-- - id: single()- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.single'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .limit(1)- .single()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": {- "name": "Afghanistan"- },- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .limit(1)- .single()- ```-- - id: maybeSingle()- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.maybeSingle'- examples:- - id: with`select()`- name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .eq('name', 'Singapore')- .maybeSingle()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .eq('name', 'Singapore')- .maybeSingle()- ```-- - id: db.csv()- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.csv'- title: csv()- examples:- - id: return-data-as-csv- name: Return data as CSV- description: |- By default, the data is returned in JSON format, but can also be returned as Comma Separated Values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .csv()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": "id,name\n1,Afghanistan\n2,Albania\n3,Algeria",- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .csv()- ```-- # NOTE: Not available on currently deployed PostgREST- # db.geojson():- # $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.geojson'- # title: geojson()-- # NOTE: Not available on currently deployed PostgREST- # db.explain():- # $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.explain'- # title: explain()-- # NOTE: Not available on currently deployed PostgREST- # db.rollback():- # $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.rollback'- # title: rollback()- # examples:- # - id: With `delete()`- # description: |- # <details>- # <summary>Schema</summary>-- # ```sql- # create table- # countries (id int8 primary key, name text);-- # insert into- # countries (id, name)- # values- # (1, 'Spain');- # ```- # </details>-- # ```ts- # const { error } = await supabase- # .from('countries')- # .delete()- # .eq('id', 1)- # .rollback()- # ```-- # <details>- # <summary>Result</summary>-- # ```json- # {- # "status": 204,- # "statusText": "No Content"- # }- # ```- # </details>-- # ```ts- # const { data, error } = await supabase- # .from('countries')- # .select()- # ```-- # <details>- # <summary>Result</summary>-- # ```json- # {- # "data": [- # {- # "id": 1,- # "name": "Spain"- # }- # ],- # "status": 200,- # "statusText": "OK"- # }- # ```- # </details>- # hideCodeBlock: true- # isSpotlight: true- # js: |- # ```ts- # const { error } = await supabase- # .from('countries')- # .delete()- # .eq('id', 1)- # ```-- - id: invoke()- title: 'invoke()'- description: |- Invoke a Supabase Function.- $ref: '@supabase/functions-js.FunctionsClient.invoke'- notes: |- - Requires an Authorization header.- - Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec.- - When you pass in a body to your function, we automatically attach the Content-Type header for `Blob`, `ArrayBuffer`, `File`, `FormData` and `String`. If it doesn't match any of these types we assume the payload is `json`, serialise it and attach the `Content-Type` header as `application/json`. You can override this behaviour by passing in a `Content-Type` header of your own.- - Responses are automatically parsed as `json`, `blob` and `form-data` depending on the `Content-Type` header sent by your function. Responses are parsed as `text` by default.- examples:- - id: basic-invocation.- name: Basic invocation.- description:- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.functions.invoke('hello', {- body: { foo: 'bar' }- })- ```- - id: error-handling.- name: Error handling.- description: |- A `FunctionsHttpError` error is returned if your function throws an error, `FunctionsRelayError` if the Supabase Relay has an error processing your function and `FunctionsFetchError` if there is a network error in calling your function.- isSpotlight: true- js: |- ```js- import { FunctionsHttpError, FunctionsRelayError, FunctionsFetchError } from "@supabase/supabase-js";-- const { data, error } = await supabase.functions.invoke('hello', {- headers: {- "my-custom-header": 'my-custom-header-value'- },- body: { foo: 'bar' }- })-- if (error instanceof FunctionsHttpError) {- const errorMessage = await error.context.json()- console.log('Function returned an error', errorMessage)- } else if (error instanceof FunctionsRelayError) {- console.log('Relay error:', error.message)- } else if (error instanceof FunctionsFetchError) {- console.log('Fetch error:', error.message)- }- ```- - id: passing-custom-headers.- name: Passing custom headers.- description: |- You can pass custom headers to your function. Note: supabase-js automatically passes the `Authorization` header with the signed in user's JWT.- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.functions.invoke('hello', {- headers: {- "my-custom-header": 'my-custom-header-value'- },- body: { foo: 'bar' }- })- ```-- - id: subscribe()- title: 'on().subscribe()'- $ref: '@supabase/realtime-js.RealtimeChannel.on'- notes: |- - Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/database/api#managing-realtime).- - Row level security is not applied to delete statements.- - If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY` to `FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL;`- - When a delete occurs, the contents of old_record will be broadcast to all subscribers to that table so ensure that each table's replica identity only contains information that is safe to expose publicly.- - The channel name must exactly match the schema/table/filter you want to listen to separated by colons. See below examples for additional context.- examples:- - id: listen-to-all-database-changes- name: Listen to all database changes- isSpotlight: true- js: |- ```js- supabase- .channel('*')- .on('postgres_changes', { event: '*', schema: '*' }, payload => {- console.log('Change received!', payload)- })- .subscribe()- ```- - id: listen-to-a-specific-table- name: Listen to a specific table- js: |- ```js- supabase- .channel('public:countries')- .on('postgres_changes', { event: '*', schema: 'public', table: 'countries' }, payload => {- console.log('Change received!', payload)- })- .subscribe()- ```- - id: listen-to-inserts- name: Listen to inserts- js: |- ```js- supabase- .channel('public:countries')- .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'countries' }, payload => {- console.log('Change received!', payload)- })- .subscribe()- ```- - id: listen-to-updates- name: Listen to updates- description: |- By default, Supabase will send only the updated record. If you want to receive the previous values as well you can- enable full replication for the table you are listening to:-- ```sql- alter table "your_table" replica identity full;- ```- js: |- ```js- supabase- .channel('public:countries')- .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'countries' }, payload => {- console.log('Change received!', payload)- })- .subscribe()- ```- - id: listen-to-deletes- name: Listen to deletes- description: |- By default, Supabase does not send deleted records. If you want to receive the deleted record you can- enable full replication for the table you are listening too:-- ```sql- alter table "your_table" replica identity full;- ```- js: |- ```js- supabase- .channel('public:countries')- .on('postgres_changes', { event: 'DELETE', schema: 'public', table: 'countries' }, payload => {- console.log('Change received!', payload)- })- .subscribe()- ```- - id: listen-to-multiple-events- name: Listen to multiple events- description: You can chain listeners if you want to listen to multiple events for each table.- js: |- ```js- supabase- .channel('public:countries')- .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'countries' }, handleRecordInserted)- .on('postgres_changes', { event: 'DELETE', schema: 'public', table: 'countries' }, handleRecordDeleted)- .subscribe()- ```- - id: listening-to-row-level-changes- name: Listen to row level changes- description: You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match.- notes: |- - ``eq`` filter works with all database types as under the hood, it's casting both the filter value and the database value to the correct type and then comparing them.- js: |- ```js- supabase- .channel('public:countries:id=eq.200')- .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'countries', filter: 'id=eq.200' }, handleRecordUpdated)- .subscribe()- ```-- - id: getChannels()- title: 'getChannels()'- $ref: '@supabase/supabase-js.index.SupabaseClient.getChannels'- examples:- - id: get-all-channels- name: Get all channels- isSpotlight: true- js: |- ```js- const channels = supabase.getChannels()- ```-- - id: removeChannel()- title: 'removeChannel()'- $ref: '@supabase/supabase-js.index.SupabaseClient.removeChannel'- notes: |- - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.- examples:- - id: removes-a-channel- name: Removes a channel- isSpotlight: true- js: |- ```js- supabase.removeChannel(myChannel)- ```-- - id: removeAllChannels()- title: 'removeAllChannels()'- $ref: '@supabase/supabase-js.index.SupabaseClient.removeAllChannels'- notes: |- - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.- examples:- - id: remove-all-channels- name: Remove all channels- isSpotlight: true- js: |- ```js- supabase.removeAllChannels()- ```-- - id: storage.listBuckets()- title: 'listBuckets()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.listBuckets'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `select`- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: list-buckets- name: List buckets- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .listBuckets()- ```-- - id: storage.getBucket()- title: 'getBucket()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.getBucket'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `select`- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: get-bucket- name: Get bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .getBucket('avatars')- ```-- - id: storage.createBucket()- title: 'createBucket()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.createBucket'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `insert`- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: create-bucket- name: Create bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .createBucket('avatars', { public: false })- ```-- - id: storage.emptyBucket()- title: 'emptyBucket()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.emptyBucket'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `select`- - `objects` table permissions: `select` and `delete`- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: empty-bucket- name: Empty bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .emptyBucket('avatars')- ```- - id: storage.updateBucket()- title: 'updateBucket()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.updateBucket'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `update`- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: update-bucket- name: Update bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .updateBucket('avatars', { public: false })- ```-- - id: storage.deleteBucket()- title: 'deleteBucket()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.deleteBucket'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `select` and `delete`- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: delete-bucket- name: Delete bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .deleteBucket('avatars')- ```-- - id: storage.from.upload()- title: 'from.upload()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.upload'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `insert`- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Upload file using `ArrayBuffer` from base64 file data instead, see example below.- examples:- - id: upload-file- name: Upload file- isSpotlight: true- js: |- ```js- const avatarFile = event.target.files[0]- const { data, error } = await supabase- .storage- .from('avatars')- .upload('public/avatar1.png', avatarFile, {- cacheControl: '3600',- upsert: false- })- ```- - id: upload-file-using`arraybuffer`from-base64-file-data- name: Upload file using `ArrayBuffer` from base64 file data- js: |- ```js- import { decode } from 'base64-arraybuffer'-- const { data, error } = await supabase- .storage- .from('avatars')- .upload('public/avatar1.png', decode('base64FileData'), {- contentType: 'image/png'- })- ```-- - id: storage.from.update()- title: 'from.update()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.update'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `update` and `select`- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below.- examples:- - id: update-file- name: Update file- isSpotlight: true- js: |- ```js- const avatarFile = event.target.files[0]- const { data, error } = await supabase- .storage- .from('avatars')- .update('public/avatar1.png', avatarFile, {- cacheControl: '3600',- upsert: false- })- ```- - id: update-file-using`arraybuffer`from-base64-file-data- name: Update file using `ArrayBuffer` from base64 file data- js: |- ```js- import {decode} from 'base64-arraybuffer'-- const { data, error } = await supabase- .storage- .from('avatars')- .update('public/avatar1.png', decode('base64FileData'), {- contentType: 'image/png'- })- ```-- - id: storage.from.move()- title: 'from.move()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.move'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `update` and `select`- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: move-file- name: Move file- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .move('public/avatar1.png', 'private/avatar2.png')- ```-- - id: storage.from.copy()- title: 'from.copy()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.copy'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `insert` and `select`- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: copy-file- name: Copy file- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .copy('public/avatar1.png', 'private/avatar2.png')- ```-- - id: storage.from.createSignedUrl()- title: 'from.createSignedUrl()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.createSignedUrl'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `select`- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: create-signed-url- name: Create Signed URL- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .createSignedUrl('folder/avatar1.png', 60)- ```-- - id: storage.from.createSignedUrls()- title: 'from.createSignedUrls()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.createSignedUrls'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `select`- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: create-signed-urls- name: Create Signed URLs- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60)- ```-- - id: storage.from.getPublicUrl()- title: 'from.getPublicUrl()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.getPublicUrl'- notes: |- - The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [supabase.com/dashboard](https://supabase.com/dashboard), clicking the overflow menu on a bucket and choosing "Make public"- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: returns-the-url-for-an-asset-in-a-public-bucket- name: Returns the URL for an asset in a public bucket- isSpotlight: true- js: |- ```js- const { data } = supabase- .storage- .from('public-bucket')- .getPublicUrl('folder/avatar1.png')- ```-- - id: storage.from.download()- title: 'from.download()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.download'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `select`- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: download-file- name: Download file- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .download('folder/avatar1.png')- ```-- - id: storage.from.remove()- title: 'from.remove()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.remove'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `delete` and `select`- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: delete-file- name: Delete file- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .remove(['folder/avatar1.png'])- ```-- - id: storage.from.list()- title: 'from.list()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.list'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `select`- - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works- examples:- - id: list-files-in-a-bucket- name: List files in a bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .list('folder', {- limit: 100,- offset: 0,- sortBy: { column: 'name', order: 'asc' },- })- ```- - id: search-files-in-a-bucket- name: Search files in a bucket- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .list('folder', {- limit: 100,- offset: 0,- sortBy: { column: 'name', order: 'asc' },- search: 'jon'- })- ```diff --git a/apps/docs/spec/supabase_dart_v1.yml b/apps/docs/spec/supabase_dart_v1.ymlindex 26db52c7e24..e58342d068d 100644--- a/apps/docs/spec/supabase_dart_v1.yml+++ b/apps/docs/spec/supabase_dart_v1.yml@@ -173,7 +173,7 @@ functions:```dartawait supabase.auth.signInWithOtp(phone: '+13334445555',- channel: OtpChannel.whatsapp,+ channel: OtpChannel.whatsapp,);```- id: sign-in-with-apple@@ -459,7 +459,7 @@ functions:- id: auth-mfa-apititle: 'Overview'notes: |- This section contains methods commonly used for Multi-Factor Authentication (MFA) and are invoked behind the `supabase.auth.mfa` namespace.+ This section contains methods commonly used for Multi-Factor Authentication (MFA) and are invoked behind the `supabase.auth.mfa` namespace.Currently, we only support time-based one-time password (TOTP) as the 2nd factor. We don't support recovery codes but we allow users to enroll more than 1 TOTP factor, with an upper limit of 10.@@ -1683,7 +1683,7 @@ functions:final data = await supabase.from('countries').select('name, cities(name)')- .eq('name', 'United States')+ .eq('name', 'Rohan').limit(1, foreignTable: 'cities' );```@@ -1709,7 +1709,7 @@ functions:final data = await supabase.from('countries').select('name, cities(name)')- .eq('name', 'United States')+ .eq('name', 'Rohan').order('name', foreignTable: 'cities');```@@ -1854,47 +1854,47 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('orchestral_sections').select('''name,- cities!inner (+ instruments!inner (name)''')- .eq('cities.name', 'Bali');+ .eq('instruments.name', 'violin');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "strings",+ "characters": [{- "name": "Bali"+ "name": "violin"}]}@@ -1931,9 +1931,9 @@ functions:code: |```dartfinal data = await supabase- .from('cities')- .select('name, country_id')- .or('id.gt.20,and(name.eq.New Zealand,name.eq.France)');+ .from('instruments')+ .select('name, section_id')+ .or('id.gt.20,and(name.eq.violin,section_id.eq.3)');```- id: not@@ -1944,7 +1944,7 @@ functions:- `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values.```dart- .not('name','eq','Paris')+ .not('name','eq','violin').not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains..not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column..not('id','in','(6,7)') // Use Postgres list () and 'in' for in_ filter.@@ -1957,27 +1957,27 @@ functions:code: |```dartfinal data = await supabase- .from('cities')- .select('name, country_id')- .not('name', 'eq', 'Paris');+ .from('instruments')+ .select('name, section_id')+ .not('name', 'eq', 'violin');```- id: with-updatename: With `update()`code: |```dartfinal data = await supabase- .from('cities')- .update({ 'name': 'Mordor' })- .not('name', 'eq', 'Paris');+ .from('instruments')+ .update({ 'name': 'piano' })+ .not('name', 'eq', 'guitar');```- id: with-deletename: With `delete()`code: |```dartfinal data = await supabase- .from('cities')+ .from('instruments').delete()- .not('name', 'eq', 'Paris');+ .not('name', 'eq', 'harp');```- id: with-rpcname: With `rpc()`@@ -1985,8 +1985,8 @@ functions:```dart// Only valid if the Stored Procedure returns a table type.final data = await supabase- .rpc('echo_all_cities)- .not('name', 'eq', 'Paris');+ .rpc('echo_all_instruments)+ .not('name', 'eq', 'violin');```- id: match@@ -2000,27 +2000,27 @@ functions:code: |```dartfinal data = await supabase- .from('cities')- .select('name, country_id')- .match({'name': 'Beijing', 'country_id': 156});+ .from('instruments')+ .select('name, section_id')+ .match({'name': 'drums', 'section_id': 2});```- id: with-updatename: With `update()`code: |```dartfinal data = await supabase- .from('cities')- .update({ 'name': 'Mordor' })- .match({'name': 'Beijing', 'country_id': 156});+ .from('instruments')+ .update({ 'name': 'piano' })+ .match({'name': 'harpsichord', 'section_id': 2});```- id: with-deletename: With `delete()`code: |```dartfinal data = await supabase- .from('cities')+ .from('instruments').delete()- .match({'name': 'Beijing', 'country_id': 156});+ .match({'name': 'harpsichord', 'country_id': 2});```- id: with-rpcname: With `rpc()`@@ -2028,8 +2028,8 @@ functions:```dart// Only valid if the Stored Procedure returns a table type.final data = await supabase- .rpc('echo_all_cities')- .match({'name': 'Beijing', 'country_id': 156});+ .rpc('echo_all_instruments')+ .match({'name': 'violin', 'country_id': 3});```- id: eq@@ -2043,27 +2043,27 @@ functions:code: |```dartfinal data = await supabase- .from('cities')- .select('name, country_id')- .eq('name', 'The shire');+ .from('instruments')+ .select('name, section_id')+ .eq('name', 'xylophone');```- id: with-updatename: With `update()`code: |```dartfinal data = await supabase- .from('cities')- .update({ 'name': 'Mordor' })- .eq('name', 'San Francisco');+ .from('instruments')+ .update({ 'name': 'piano' })+ .eq('name', 'harpsichord');```- id: with-deletename: With `delete()`code: |```dartfinal data = await supabase- .from('cities')+ .from('instruments').delete()- .eq('name', 'Mordor');+ .eq('name', 'tambourine');```- id: with-rpcname: With `rpc()`@@ -2071,8 +2071,8 @@ functions:```dart// Only valid if the Stored Procedure returns a table type.final data = await supabase- .rpc('echo_all_cities')- .eq('name', 'San Francisco');+ .rpc('echo_all_instruments')+ .eq('name', 'guqin');```- id: neq@@ -2086,27 +2086,27 @@ functions:code: |```dartfinal data = await supabase- .from('cities')- .select('name, country_id')- .neq('name', 'The shire');+ .from('instruments')+ .select('name, section_id')+ .neq('name', 'violin');```- id: with-updatename: With `update()`code: |```dartfinal data = await supabase- .from('cities')- .update({ 'name': 'Mordor' })- .neq('name', 'San Francisco');+ .from('instruments')+ .update({ 'name': 'piano' })+ .neq('name', 'harp');```- id: with-deletename: With `delete()`code: |```dartfinal data = await supabase- .from('cities')+ .from('instruments').delete()- .neq('name', 'Mordor');+ .neq('name', 'cello');```- id: with-rpcname: With `rpc()`@@ -2114,8 +2114,8 @@ functions:```dart// Only valid if the Stored Procedure returns a table type.final data = await supabase- .rpc('echo_all_cities')- .neq('name', 'Lagos');+ .rpc('echo_all_instruments')+ .neq('name', 'violin');```- id: gt@@ -2438,7 +2438,7 @@ functions:final data = await supabase.from('cities').select('name, country_id')- .in_('name', ['Rio de Janeiro', 'San Francisco']);+ .in_('name', ['Minas Tirith', 'Minas Morgul']);```- id: with-updatename: With `update()`@@ -2446,8 +2446,8 @@ functions:```dartfinal data = await supabase.from('cities')- .update({ 'name': 'Mordor' })- .in_('name', ['Rio de Janeiro', 'San Francisco']);+ .update({ 'name': 'Minas Morgul' })+ .in_('name', ['Minas Ithil', 'Minas Tirith']);```- id: with-deletename: With `delete()`@@ -2456,7 +2456,7 @@ functions:final data = await supabase.from('cities').delete()- .in_('name', ['Rio de Janeiro', 'San Francisco']);+ .in_('name', ['Minas Tirith', 'Minas Morgul']);```- id: with-rpcname: With `rpc()`@@ -2465,7 +2465,7 @@ functions:// Only valid if the Stored Procedure returns a table type.final data = await supabase.rpc('echo_all_cities')- .in_('name', ['Rio de Janeiro', 'San Francisco']);+ .in_('name', ['Minas Tirith', 'Minas Morgul']);```- id: contains@@ -2883,7 +2883,7 @@ functions:final data = await supabase.from('cities').select('name, country_id')- .filter('name', 'in', '("Paris","Tokyo")');+ .filter('name', 'in', '("Minas Tirith","Minas Morgul")');```- id: with-updatename: With `update()`@@ -2891,8 +2891,8 @@ functions:```dartfinal data = await supabase.from('cities')- .update({ 'name': 'Mordor' })- .filter('name', 'in', '("Paris","Tokyo")');+ .update({ 'name': 'Minas Morgul' })+ .filter('name', 'in', '("Minas Ithil","Minas Tirith")');```- id: with-deletename: With `delete()`@@ -2901,7 +2901,7 @@ functions:final data = await supabase.from('cities').delete()- .filter('name', 'in', '("Paris","Tokyo")');+ .filter('name', 'in', '("Minas Tirith","Minas Morgul")');```- id: with-rpcname: With `rpc()`@@ -2910,7 +2910,7 @@ functions:// Only valid if the Stored Procedure returns a table type.final data = await supabase.rpc('echo_all_cities')- .filter('name', 'in', '("Paris","Tokyo")');+ .filter('name', 'in', '("Minas Tirith","Minas Morgul")');```- id: filter-embedded-resourcesname: Filter embedded resources@@ -2919,5 +2919,5 @@ functions:final data = await supabase.from('cities').select('name, countries ( name )')- .filter('countries.name', 'in', '("France","Japan")');+ .filter('countries.name', 'in', '("Rohan","Gondor")');```diff --git a/apps/docs/spec/supabase_dart_v2.yml b/apps/docs/spec/supabase_dart_v2.ymlindex 98073255510..c058763c23c 100644--- a/apps/docs/spec/supabase_dart_v2.yml+++ b/apps/docs/spec/supabase_dart_v2.yml@@ -552,7 +552,7 @@ functions:```dartawait supabase.auth.signInWithOtp(phone: '+13334445555',- channel: OtpChannel.whatsapp,+ channel: OtpChannel.whatsapp,);```- id: sign-in-with-id-token@@ -1314,7 +1314,7 @@ functions:// retrieve all identites linked to a userfinal identities = await supabase.auth.getUserIdentities();- // find the google identity+ // find the google identityfinal googleIdentity = identities.firstWhere((element) => element.provider == 'google',);@@ -1631,7 +1631,7 @@ functions:- id: auth-mfa-apititle: 'Overview'notes: |- This section contains methods commonly used for Multi-Factor Authentication (MFA) and are invoked behind the `supabase.auth.mfa` namespace.+ This section contains methods commonly used for Multi-Factor Authentication (MFA) and are invoked behind the `supabase.auth.mfa` namespace.Currently, we only support time-based one-time password (TOTP) as the 2nd factor. We don't support recovery codes but we allow users to enroll more than 1 TOTP factor, with an upper limit of 10.@@ -2496,36 +2496,36 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select();```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json[{'id': 1,- 'name': 'Afghanistan'+ 'name': 'violin'},{'id': 2,- 'name': 'Albania'+ 'name': 'viola'},{'id': 3,- 'name': 'Algeria'+ 'name': 'cello'},]```@@ -2535,38 +2535,35 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select('''- name,- cities (- name- )+ name''');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json[{- 'name': 'Afghanistan'+ 'name': 'violin'},{- 'name': 'Albania'+ 'name': 'viola'},{- 'name': 'Algeria'+ 'name': 'cello'},]```@@ -2587,41 +2584,41 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json[{- 'name': 'Germany',- 'cities': [+ 'name': 'strings',+ 'instruments': [{- 'name': 'Munich'+ 'name': 'violin'},]},{- 'name': 'Indonesia',- 'cities': [+ 'name': 'woodwinds',+ 'instruments': [{- 'name': 'Bali'+ 'name': 'flute'},]},@@ -2772,43 +2769,43 @@ functions:code: |```dartfinal data = await supabase- .from('cities')- .select('name, countries(*)')- .eq('countries.name', 'Estonia');+ .from('instruments')+ .select('name, orchestral_sections(*)')+ .eq('orchestral_sections.name', 'percussion');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json[{- 'name': 'Bali',- 'countries': null+ 'name': 'flute',+ 'orchestral_sections': null},{- 'name': 'Munich',- 'countries': null+ 'name': 'violin',+ 'orchestral_sections': null}]```@@ -2825,7 +2822,7 @@ functions:code: |```dartfinal res = await supabase- .from('cities')+ .from('instruments').select('name').count(CountOption.exact);@@ -2836,14 +2833,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json@@ -2851,15 +2848,15 @@ functions:data: [{'id': 1,- 'name': 'Afghanistan'+ 'name': 'violin'},{'id': 2,- 'name': 'Albania'+ 'name': 'viola'},{'id': 3,- 'name': 'Algeria'+ 'name': 'cello'}],count: 3@@ -2895,15 +2892,15 @@ functions:insert intousers (id, name, address)values- (1, 'Avdotya', '{"city":"Saint Petersburg"}');+ (1, 'Frodo', '{"city":"Hobbiton"}');```response: |```json[{'id': 1,- 'name': 'Avdotya',- 'city': 'Saint Petersburg'+ 'name': 'Frodo',+ 'city': 'Hobbiton'}]```@@ -2912,46 +2909,47 @@ functions:code: |```dartfinal data = await supabase- .from('cities')- .select('name, countries!inner(name)')- .eq('countries.name', 'Indonesia');+ .from('orchestral_sections')+ .select('name, instruments!inner(name)')+ .eq('orchestral_sections.name', 'strings')+ .limit(1);```data:sql: |```sql- create table countries (+ create table orchestral_sections ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text);- create table cities (+ create table instruments ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text,- "country_id" "uuid" references public.countries on delete cascade+ "section_id" "uuid" references public.orchestral_sections on delete cascade);- with country as (- insert into countries (name)- values ('united kingdom') returning id+ with section as (+ insert into orchestral_sections (name)+ values ('strings') returning id)- insert into cities (name, country_id) values- ('London', (select id from country)),- ('Manchester', (select id from country)),- ('Liverpool', (select id from country)),- ('Bristol', (select id from country));+ insert into instruments (name, section_id) values+ ('violin', (select id from section)),+ ('viola', (select id from section)),+ ('cello', (select id from section)),+ ('double bass', (select id from section));```response: |```json[{- 'name': 'Bali',- 'countries': {'name': 'Indonesia'}+ 'name': 'violin',+ 'orchestral_sections': {'name': 'strings'}}]```description: |If you don't want to return the referenced table contents, you can leave the parenthesis empty.- Like `.select('name, countries!inner()')`.+ Like `.select('name, books!inner()')`.hideCodeBlock: true- id: switching-schemas-per-queryname: Switching schemas per query@@ -3081,28 +3079,28 @@ functions:code: |```dartawait supabase- .from('countries')- .update({ 'name': 'Australia' })+ .from('instruments')+ .update({ 'name': 'piano' }).eq('id', 1);```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Taiwan');+ (1, 'harpsichord');```- id: update-a-record-and-return-itname: Update a record and return itcode: |```dartfinal data = await supabase- .from('countries')- .update({ 'name': 'Australia' })+ .from('instruments')+ .update({ 'name': 'piano' }).eq('id', 1).select();```@@ -3110,19 +3108,19 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Taiwan');+ (1, 'harpsichord');```response: |```json[{'id': 1,- 'name': 'Australia'+ 'name': 'piano'}]```@@ -3204,27 +3202,27 @@ functions:code: |```dartfinal data = await supabase- .from('countries')- .upsert({ 'id': 1, 'name': 'Albania' })+ .from('instruments')+ .upsert({ 'id': 1, 'name': 'piano' }).select();```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json[{'id': 1,- 'name': 'Albania'+ 'name': 'piano'}]```@@ -3233,10 +3231,10 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').upsert([- { 'id': 1, 'name': 'Albania' },- { 'id': 2, 'name': 'Algeria' },+ { 'id': 1, 'name': 'piano' },+ { 'id': 2, 'name': 'harp' },]).select();```@@ -3244,23 +3242,23 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json[{'id': 1,- 'name': 'Albania'+ 'name': 'piano'},{'id': 2,- 'name': 'Algeria'+ 'name': 'harp'}]```@@ -3334,7 +3332,7 @@ functions:insert intocountries (id, name)values- (1, 'Spain');+ (1, 'Mordor');```- id: delete-multiple-recordsname: Delete multiple records@@ -3354,7 +3352,7 @@ functions:insert intocountries (id, name)values- (1, 'Spain'), (2, 'France'), (3, 'Germany');+ (1, 'Mordor'), (2, 'Gondor'), (3, 'Rohan');```- id: fetch-delete-recordsname: Fetch deleted records@@ -3466,8 +3464,8 @@ functions:insert intocountries (id, name)values- (1, 'France'),- (2, 'United Kingdom');+ (1, 'Mordor'),+ (2, 'Gondor');create function list_stored_countries() returns setof countries as $$select * from countries;@@ -3477,7 +3475,7 @@ functions:```json{'id': 1,- 'name': 'France'+ 'name': 'Mordor'}```description: |@@ -4538,27 +4536,27 @@ functions:code: |```dartfinal data = await supabase- .from('countries')- .upsert({ 'id': 1, 'name': 'Algeria' })+ .from('instruments')+ .upsert({ 'id': 1, 'name': 'piano' }).select();```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json[{"id": 1,- "name": "Algeria"+ "name": "piano"}]```@@ -4592,7 +4590,7 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select('id, name').order('id', ascending: false);```@@ -4600,29 +4598,29 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json[{'id': 3,- 'name': 'Algeria'+ 'name': 'cello'},{'id': 2,- 'name': 'Albania'+ 'name': 'viola'},{'id': 1,- 'name': 'Afghanistan'+ 'name': 'viola'}]```@@ -4631,55 +4629,55 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('orchestral_sections').select('''name,- cities (+ instruments (name)''')- .order('name', referencedTable: 'cities', ascending: false);+ .order('name', referencedTable: 'instruments', ascending: false);```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States'),- (2, 'Vanuatu');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json[{- 'name': 'United States',- 'cities': [+ 'name': 'strings',+ 'instruments': [{- 'name': 'New York City'+ 'name': 'violin'},{- 'name': 'Atlanta'+ 'name': 'harp'}]},{- 'name': 'Vanuatu',- 'cities': []+ 'name': 'woodwinds',+ 'instruments': []}]```@@ -4688,48 +4686,48 @@ functions:code: |```dartfinal data = await supabase- .from('cities')+ .from('instruments').select('''name,- country:countries (+ section:orchestral_sections (name)''')- .order('country(name)', ascending: true)+ .order('section(name)', ascending: true)```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Munich'),- (2, 2, 'Bali');+ (1, 1, 'violin'),+ (2, 2, 'flute');```response: |```json[{- "name": "Munich",- "country": { "name": "Germany" }+ "name": "violin",+ "orchestral_sections": { "name": "strings" }},{- "name": "Bali",- "country": { "name": "Indonesia" }+ "name": "flute",+ "orchestral_sections": { "name": "woodwinds" }}]```@@ -4753,7 +4751,7 @@ functions:code: |```dartfinal data = await supabase- .from('cities')+ .from('instruments').select('name').limit(1);```@@ -4761,20 +4759,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json[{- 'name': 'Afghanistan'+ 'name': 'violin'}]```@@ -4783,45 +4781,45 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('orchestral_sections').select('''name,- cities (+ instruments (name)''')- .limit(1, referencedTable: 'cities');+ .limit(1, referencedTable: 'instruments');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States');+ (1, 'strings');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'violin'),+ (2, 1, 'viola');```response: |```json[{- 'name': 'United States',- 'cities': [+ 'name': 'strings',+ 'instruments': [{- 'name': 'Atlanta'+ 'name': 'violin'}]}@@ -4851,7 +4849,7 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select('name').range(0, 1);```@@ -4859,23 +4857,23 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json[{- 'name': 'Afghanistan'+ 'name': 'violin'},{- 'name': 'Albania'+ 'name': 'viola'}]```@@ -4890,7 +4888,7 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select('name').limit(1).single();@@ -4899,19 +4897,19 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{- 'name': 'Afghanistan'+ 'name': 'violin'}```- id: maybe-single@@ -4922,23 +4920,23 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select()- .eq('name', 'Singapore')+ .eq('name', 'guzheng').maybeSingle();```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json@@ -4954,7 +4952,7 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select().csv();```@@ -4962,18 +4960,18 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json- 'id,name\n1,Afghanistan\n1,Albania\n1,Algeria'+ 'id,name\n1,violin\n2,viola\n3,cello'```description: |By default, the data is returned in JSON format, but can also be returned as Comma Separated Values.@@ -5016,7 +5014,7 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select().explain();```@@ -5024,20 +5022,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```Aggregate (cost=33.34..33.36 rows=1 width=112)-> Limit (cost=0.00..18.33 rows=1000 width=40)- -> Seq Scan on countries (cost=0.00..22.00 rows=1200 width=40)+ -> Seq Scan on instruments (cost=0.00..22.00 rows=1200 width=40)```description: |By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.@@ -5049,7 +5047,7 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select().explain(analyze:true, verbose:true);```@@ -5057,23 +5055,23 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```Aggregate (cost=33.34..33.36 rows=1 width=112) (actual time=0.041..0.041 rows=1 loops=1)- Output: NULL::bigint, count(ROW(countries.id, countries.name)), COALESCE(json_agg(ROW(countries.id, countries.name)), '[]'::json), NULLIF(current_setting('response.headers'::text, true), ''::text), NULLIF(current_setting('response.status'::text, true), ''::text)+ Output: NULL::bigint, count(ROW(instruments.id, instruments.name)), COALESCE(json_agg(ROW(instruments.id, instruments.name)), '[]'::json), NULLIF(current_setting('response.headers'::text, true), ''::text), NULLIF(current_setting('response.status'::text, true), ''::text)-> Limit (cost=0.00..18.33 rows=1000 width=40) (actual time=0.005..0.006 rows=3 loops=1)- Output: countries.id, countries.name- -> Seq Scan on public.countries (cost=0.00..22.00 rows=1200 width=40) (actual time=0.004..0.005 rows=3 loops=1)- Output: countries.id, countries.name+ Output: instruments.id, instruments.name+ -> Seq Scan on public.instruments (cost=0.00..22.00 rows=1200 width=40) (actual time=0.004..0.005 rows=3 loops=1)+ Output: instruments.id, instruments.nameQuery Identifier: -4730654291623321173Planning Time: 0.407 msExecution Time: 0.119 ms@@ -5183,46 +5181,46 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('orchestral_sections').select('''name,- cities!inner (+ instruments!inner (name)''')- .eq('cities.name', 'Bali');+ .eq('instruments.name', 'flute');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json[{- 'name': 'Indonesia',- 'cities': [+ 'name': 'strings',+ 'instruments': [{- 'name': 'Bali'+ 'name': 'flute'}]},@@ -5259,31 +5257,31 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select('name')- .or('id.eq.2,name.eq.Algeria');+ .or('id.eq.2,name.eq.cello');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json[{- 'name': 'Albania'+ 'name': 'viola'},{- 'name': 'Algeria'+ 'name': 'cello'}]```@@ -5292,28 +5290,28 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select('name')- .or('id.gt.3,and(id.eq.1,name.eq.Afghanistan)');+ .or('id.gt.3,and(id.eq.1,name.eq.violin)');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```reponse: |```json[{- 'name': 'Afghanistan'+ 'name': 'violin'}]```@@ -5322,46 +5320,46 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('orchestral_sections').select('''name,- cities!inner (+ instruments!inner (name)''')- .or('country_id.eq.1,name.eq.Beijing', referencedTable: 'cities' );+ .or('section_id.eq.1,name.eq.guzheng', referencedTable: 'instruments' );```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, book_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json[{- 'name': 'Germany',- 'cities': [+ 'name': 'strings',+ 'instruments': [{- 'name': 'Munich'+ 'name': 'violin'}]}@@ -5377,7 +5375,7 @@ functions:- `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values.```dart- .not('name','eq','Paris')+ .not('name','eq','violin').not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains..not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column..not('id','in','(6,7)') // Use Postgres list () and 'in' instead of `inFilter`.@@ -5435,7 +5433,7 @@ functions:final data = await supabase.from('cities').update({ 'name': 'Mordor' })- .not('name', 'eq', 'Paris');+ .not('name', 'eq', 'Rohan');```- id: with-deletename: With `delete()`@@ -5444,7 +5442,7 @@ functions:final data = await supabase.from('cities').delete()- .not('name', 'eq', 'Paris');+ .not('name', 'eq', 'Mordor');```- id: with-rpcname: With `rpc()`@@ -5453,7 +5451,7 @@ functions:// Only valid if the Stored Procedure returns a table type.final data = await supabase.rpc('echo_all_cities')- .not('name', 'eq', 'Paris');+ .not('name', 'eq', 'Mordor');```- id: match@@ -5471,28 +5469,28 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select()- .match({ 'id': 2, 'name': 'Albania' });+ .match({ 'id': 2, 'name': 'viola' });```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json[{- 'name': 'Albania'+ 'name': 'viola'}]```@@ -5518,29 +5516,29 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('instruments').select()- .eq('name', 'Albania');+ .eq('name', 'viola');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json[{'id': 2,- 'name': 'Albania'+ 'name': 'viola'},]```@@ -5566,33 +5564,33 @@ functions:code: |```dartfinal data = await supabase- .from('countries')- .select('name, country_id')- .neq('name', 'Albania');+ .from('instruments')+ .select('id, name')+ .neq('name', 'viola');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json[{'id': 1,- 'name': 'Afghanistan'+ 'name': 'violin'},{'id': 3,- 'name': 'Algeria'+ 'name': 'cello'},]```@@ -5631,16 +5629,16 @@ functions:insert intocountries (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Rohan'),+ (2, 'The Shire'),+ (3, 'Mordor');```response: |```json[{'id': 3,- 'name': 'Algeria'+ 'name': 'Mordor'},]```@@ -5679,20 +5677,20 @@ functions:insert intocountries (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Rohan'),+ (2, 'The Shire'),+ (3, 'Mordor');```response: |```json[{'id': 2,- 'name': 'Albania'+ 'name': 'The Shire'},{'id': 3,- 'name': 'Algeria'+ 'name': 'Mordor'},]```@@ -5731,16 +5729,16 @@ functions:insert intocountries (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Rohan'),+ (2, 'The Shire'),+ (3, 'Mordor');```response: |```json[{'id': 1,- 'name': 'Afghanistan'+ 'name': 'Rohan'},]```@@ -5779,20 +5777,20 @@ functions:insert intocountries (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Rohan'),+ (2, 'The Shire'),+ (3, 'Mordor');```response: |```json[{'id': 1,- 'name': 'Afghanistan'+ 'name': 'Rohan'},{'id': 2,- 'name': 'Albania'+ 'name': 'The Shire'},]```@@ -5818,29 +5816,29 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('planets').select()- .like('name', '%Alba%');+ .like('name', '%Ea%');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json[{'id': 2,- 'name': 'Albania'+ 'name': 'Earth'},]```@@ -5866,29 +5864,29 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('planets').select()- .ilike('name', '%alba%');+ .ilike('name', '%ea%');```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json[{'id': 2,- 'name': 'Albania'+ 'name': 'Earth'},]```@@ -5967,33 +5965,33 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('characters').select()- .inFilter('name', ['Albania', 'Algeria']);+ .inFilter('name', ['Luke', 'Leia']);```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Han'),+ (2, 'Luke'),+ (3, 'Leia');```response: |```json[{'id': 2,- 'name': 'Albania'+ 'name': 'Luke'},{'id': 3,- 'name': 'Algeria'+ 'name': 'Leia'},]```@@ -6769,29 +6767,29 @@ functions:code: |```dartfinal data = await supabase- .from('countries')+ .from('characters').select()- .filter('name', 'in', '("Algeria","Japan")')+ .filter('name', 'in', '("Ron","Dumbledore")')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Harry'),+ (2, 'Hermione'),+ (3, 'Ron');```response: |```json[{'id': 3,- 'name': 'Algeria'+ 'name': 'Ron'}]```@@ -6800,18 +6798,18 @@ functions:code: |```dartfinal data = await supabase- .from('cities')- .update({ 'name': 'Mordor' })- .filter('name', 'in', '("Paris","Tokyo")');+ .from('instruments')+ .update({ 'name': 'piano' })+ .filter('name', 'in', '("harpsichord","clavichord")');```- id: with-deletename: With `delete()`code: |```dartfinal data = await supabase- .from('cities')+ .from('countries').delete()- .filter('name', 'in', '("Paris","Tokyo")');+ .filter('name', 'in', '("Rohan","Mordor")');```- id: with-rpcname: With `rpc()`@@ -6819,54 +6817,54 @@ functions:```dart// Only valid if the Stored Procedure returns a table type.final data = await supabase- .rpc('echo_all_cities')- .filter('name', 'in', '("Paris","Tokyo")');+ .rpc('echo_all_countries')+ .filter('name', 'in', '("Rohan","Mordor")');```- id: on-a-referenced-tablename: On a referenced tablecode: |```dartfinal data = await supabase- .from('countries')+ .from('orchestral_sections').select('''name,- cities!inner (+ instruments!inner (name)''')- .filter('cities.name', 'eq', 'Bali')+ .filter('characters.name', 'eq', 'flute')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json[{- 'name': 'Indonesia',- 'cities': [+ 'name': 'woodwinds',+ 'instruments': [{- 'name': 'Bali'+ 'name': 'flute'}]}diff --git a/apps/docs/spec/supabase_js_v1.yml b/apps/docs/spec/supabase_js_v1.ymlindex b4fa60d2e0e..a8bbb49e0ab 100644--- a/apps/docs/spec/supabase_js_v1.yml+++ b/apps/docs/spec/supabase_js_v1.yml@@ -956,9 +956,9 @@ functions:code: |```jsconst { data, error } = await supabase- .from('cities')- .update({ name: 'Middle Earth' })- .match({ name: 'Auckland' })+ .from('characters')+ .update({ name: 'Han Solo' })+ .match({ name: 'Han' })```- id: updating-json-dataname: Updating JSON data@@ -1639,7 +1639,7 @@ functions:const { data, error } = await supabase.from('countries').select('name, cities(name)')- .eq('name', 'United States')+ .eq('name', 'The Shire').limit(1, { foreignTable: 'cities' })```@@ -1664,7 +1664,7 @@ functions:const { data, error } = await supabase.from('countries').select('name, cities(name)')- .eq('name', 'United States')+ .eq('name', 'The Shire').order('name', {foreignTable: 'cities'})```- id: ordering-multiple-columns@@ -1718,9 +1718,9 @@ functions:code: |```jsconst { data, error } = await supabase- .from('cities')- .select('name, country_id')- .eq('name', 'Singapore')+ .from('instruments')+ .select('name, section_id')+ .eq('name', 'violin').maybeSingle()```@@ -1807,9 +1807,9 @@ functions:code: |```jsconst { data, error } = await supabase- .from('cities')- .select('name, country_id')- .or('id.gt.20,and(name.eq.New Zealand,name.eq.France)')+ .from('characters')+ .select('name, book_id')+ .or('id.gt.20,and(name.eq.Harry,name.eq.Frodo)')```- id: use-or-on-foreign-tablesname: Use `or` on foreign tables@@ -1817,9 +1817,9 @@ functions:code: |```jsconst { data, error } = await supabase- .from('countries')- .select('id, cities(*)')- .or('name.eq.Wellington,name.eq.Paris', { foreignTable: "cities" })+ .from('books')+ .select('id, characters(*)')+ .or('name.eq.Luke,name.eq.Leia', { foreignTable: "characters" })```- id: not@@ -1829,7 +1829,7 @@ functions:- `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values.```js- .not('name','eq','Paris')+ .not('name','eq','Luke').not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains..not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column..not('id','in','(6,7)') // Use Postgres list () for in filter.@@ -1842,27 +1842,27 @@ functions:code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').select('name, country_id')- .not('name', 'eq', 'Paris')+ .not('name', 'eq', 'The Shire')```- id: with-updatename: With `update()`code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').update({ name: 'Mordor' })- .not('name', 'eq', 'Paris')+ .not('name', 'eq', 'Rohan')```- id: with-deletename: With `delete()`code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').delete()- .not('name', 'eq', 'Paris')+ .not('name', 'eq', 'The Shire')```- id: with-rpcname: With `rpc()`@@ -1870,8 +1870,8 @@ functions:```js// Only valid if the Postgres function returns a table type.const { data, error } = await supabase- .rpc('echo_all_cities')- .not('name', 'eq', 'Paris')+ .rpc('echo_all_countries')+ .not('name', 'eq', 'The Shire')```- id: match@@ -1884,27 +1884,27 @@ functions:code: |```jsconst { data, error } = await supabase- .from('cities')- .select('name, country_id')- .match({name: 'Beijing', country_id: 156})+ .from('characters')+ .select('name, book_id')+ .match({name: 'Harry', book_id: 156})```- id: with-updatename: With `update()`code: |```jsconst { data, error } = await supabase- .from('cities')- .update({ name: 'Mordor' })- .match({name: 'Beijing', country_id: 156})+ .from('instruments')+ .update({ name: 'piano' })+ .match({name: 'harpsichord', section_id: 2})```- id: with-deletename: With `delete()`code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').delete()- .match({name: 'Beijing', country_id: 156})+ .match({name: 'The Shire', country_id: 156})```- id: with-rpcname: With `rpc()`@@ -1912,8 +1912,8 @@ functions:```js// Only valid if the Postgres function returns a table type.const { data, error } = await supabase- .rpc('echo_all_cities')- .match({name: 'Beijing', country_id: 156})+ .rpc('echo_all_characters')+ .match({name: 'Frodo', book_id: 156})```- id: eq@@ -1935,16 +1935,16 @@ functions:code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').update({ name: 'Mordor' })- .eq('name', 'San Francisco')+ .eq('name', 'Rohan')```- id: with-deletename: With `delete()`code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').delete().eq('name', 'Mordor')```@@ -1954,8 +1954,8 @@ functions:```js// Only valid if the Postgres function returns a table type.const { data, error } = await supabase- .rpc('echo_all_cities')- .eq('name', 'San Francisco')+ .rpc('echo_all_countries')+ .eq('name', 'Mordor')```- id: neq@@ -1977,16 +1977,16 @@ functions:code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').update({ name: 'Mordor' })- .neq('name', 'San Francisco')+ .neq('name', 'Gondor')```- id: with-deletename: With `delete()`code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').delete().neq('name', 'Mordor')```@@ -1996,8 +1996,8 @@ functions:```js// Only valid if the Postgres function returns a table type.const { data, error } = await supabase- .rpc('echo_all_cities')- .neq('name', 'Lagos')+ .rpc('echo_all_countries')+ .neq('name', 'Mordor')```- id: gt@@ -2304,27 +2304,27 @@ functions:code: |```jsconst { data, error } = await supabase- .from('cities')- .select('name, country_id')- .in('name', ['Rio de Janeiro', 'San Francisco'])+ .from('characters')+ .select('name, book_id')+ .in('name', ['Harry', 'Hermione'])```- id: with-updatename: With `update()`code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').update({ name: 'Mordor' })- .in('name', ['Rio de Janeiro', 'San Francisco'])+ .in('name', ['Gondor', 'Rohan'])```- id: with-deletename: With `delete()`code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('characters').delete()- .in('name', ['Rio de Janeiro', 'San Francisco'])+ .in('name', ['Dumbledore', 'Snape'])```- id: with-rpcname: With `rpc()`@@ -2332,8 +2332,8 @@ functions:```js// Only valid if the Postgres function returns a table type.const { data, error } = await supabase- .rpc('echo_all_cities')- .in('name', ['Rio de Janeiro', 'San Francisco'])+ .rpc('echo_all_characters')+ .in('name', ['Luke', 'Leia'])```- id: contains@@ -2781,27 +2781,27 @@ functions:code: |```jsconst { data, error } = await supabase- .from('cities')- .select('name, country_id')- .filter('name', 'in', '("Paris","Tokyo")')+ .from('characters')+ .select('name, book_id')+ .filter('name', 'in', '("Harry","Hermione")')```- id: with-updatename: With `update()`code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').update({ name: 'Mordor' })- .filter('name', 'in', '("Paris","Tokyo")')+ .filter('name', 'in', '("Gondor","Rohan")')```- id: with-deletename: With `delete()`code: |```jsconst { data, error } = await supabase- .from('cities')+ .from('countries').delete()- .filter('name', 'in', '("Paris","Tokyo")')+ .filter('name', 'in', '("Mordor","The Shire")')```- id: with-rpcname: With `rpc()`@@ -2809,15 +2809,15 @@ functions:```js// Only valid if the Postgres function returns a table type.const { data, error } = await supabase- .rpc('echo_all_cities')- .filter('name', 'in', '("Paris","Tokyo")')+ .rpc('echo_all_countries')+ .filter('name', 'in', '("Mordor","The Shire")')```- id: filter-embedded-resourcesname: Filter embedded resourcescode: |```jsconst { data, error } = await supabase- .from('cities')- .select('name, countries ( name )')- .filter('countries.name', 'in', '("France","Japan")')+ .from('instruments')+ .select('name, orchestral_sections ( name )')+ .filter('orchestral_sections.name', 'in', '("strings","woodwinds")')```diff --git a/apps/docs/spec/supabase_js_v2.yml b/apps/docs/spec/supabase_js_v2.ymlindex eeeb94d5674..20f89198ded 100644--- a/apps/docs/spec/supabase_js_v2.yml+++ b/apps/docs/spec/supabase_js_v2.yml@@ -423,7 +423,7 @@ functions:- `INITIAL_SESSION`- Emitted right after the Supabase client is constructed and the initial session from storage is loaded.- `SIGNED_IN`- - Emitted each time a user session is confirmed or re-established, including on user sign in and when refocusing a tab.+ - Emitted each time a user session is confirmed or re-established, including on user sign in and when refocusing a tab.- Avoid making assumptions as to when this event is fired, this may occur even when the user is already signed in. Instead, check the user object attached to the event to see if a new user has signed in and update your application's UI.- This event can fire very frequently depending on the number of tabs open in your application.- `SIGNED_OUT`@@ -1572,7 +1572,7 @@ functions:// retrieve all identites linked to a userconst identities = await supabase.auth.getUserIdentities()- // find the google identity+ // find the google identityconst googleIdentity = identities.find(identity => identity.provider === 'google')@@ -2004,7 +2004,7 @@ functions:providers: ["email","<OTHER_PROVIDER>"- ]+ ]},user_metadata: {email: '[email protected]',@@ -2252,7 +2252,7 @@ functions:provider: 'email',providers: ["email",- ]+ ]},user_metadata: {},identities: [@@ -2329,7 +2329,7 @@ functions:provider: 'email',providers: ["email",- ]+ ]},user_metadata: {},identities: [@@ -3084,21 +3084,21 @@ functions:code: |```jsconst { data, error } = await supabase- .from('countries')+ .from('characters').select()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Harry'),+ (2, 'Frodo'),+ (3, 'Katniss');```response: |```json@@ -3106,15 +3106,15 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "Harry"},{"id": 2,- "name": "Albania"+ "name": "Frodo"},{"id": 3,- "name": "Algeria"+ "name": "Katniss"}],"status": 200,@@ -3126,34 +3126,34 @@ functions:code: |```jsconst { data, error } = await supabase- .from('countries')+ .from('characters').select('name')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Frodo'),+ (2, 'Harry'),+ (3, 'Katniss');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Frodo"},{- "name": "Albania"+ "name": "Harry"},{- "name": "Algeria"+ "name": "Katniss"}],"status": 200,@@ -3167,10 +3167,10 @@ functions:code: |```jsconst { data, error } = await supabase- .from('countries')+ .from('orchestal_sections').select(`name,- cities (+ instruments (name)`)@@ -3179,42 +3179,42 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Germany",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Munich"+ "name": "violin"}]},{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "instruments": [{- "name": "Bali"+ "name": "flute"}]}@@ -3489,44 +3489,44 @@ functions:code: |```tsconst { data, error } = await supabase- .from('cities')- .select('name, countries(*)')- .eq('countries.name', 'Estonia')+ .from('instruments')+ .select('name, orchestral_sections(*)')+ .eq('orchestral_sections.name', 'percussion')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Bali",- "countries": null+ "name": "flute",+ "orchestral_sections": null},{- "name": "Munich",- "countries": null+ "name": "violin",+ "orchestral_sections": null}],"status": 200,@@ -3543,40 +3543,40 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')- .select(`*, cities(count)`)+ .from('orchestral_sections')+ .select(`*, instruments(count)`)```data:sql: |```sql- create table countries (+ create table orchestral_sections ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text);- create table cities (+ create table characters ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text,- "country_id" "uuid" references public.countries on delete cascade+ "section_id" "uuid" references public.orchestral_sections on delete cascade);- with country as (- insert into countries (name)- values ('united kingdom') returning id+ with section as (+ insert into orchestral_sections (name)+ values ('strings') returning id)- insert into cities (name, country_id) values- ('London', (select id from country)),- ('Manchester', (select id from country)),- ('Liverpool', (select id from country)),- ('Bristol', (select id from country));+ insert into instruments (name, section_id) values+ ('violin', (select id from section)),+ ('viola', (select id from section)),+ ('cello', (select id from section)),+ ('double bass', (select id from section));```response: |```json[{"id": "693694e7-d993-4360-a6d7-6294e325d9b6",- "name": "United Kingdom",- "cities": [+ "name": "strings",+ "instruments": [{"count": 4}@@ -3593,21 +3593,21 @@ functions:code: |```tsconst { count, error } = await supabase- .from('countries')+ .from('characters').select('*', { count: 'exact', head: true })```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -3645,7 +3645,7 @@ functions:insert intousers (id, name, address)values- (1, 'Avdotya', '{"city":"Saint Petersburg"}');+ (1, 'Frodo', '{"city":"Hobbiton"}');```response: |```json@@ -3653,8 +3653,8 @@ functions:"data": [{"id": 1,- "name": "Avdotya",- "city": "Saint Petersburg"+ "name": "Frodo",+ "city": "Hobbiton"}],"status": 200,@@ -3672,41 +3672,42 @@ functions:code: |```tsconst { data, error } = await supabase- .from('cities')- .select('name, countries!inner(name)')- .eq('countries.name', 'Indonesia')+ .from('instruments')+ .select('name, orchestral_sections!inner(name)')+ .eq('orchestral_sections.name', 'woodwinds')+ .limit(1)```data:sql: |```sql- create table countries (+ create table orchestral_sections ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text);- create table cities (+ create table instruments ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text,- "country_id" "uuid" references public.countries on delete cascade+ "section_id" "uuid" references public.orchestral_sections on delete cascade);- with country as (- insert into countries (name)- values ('united kingdom') returning id+ with section as (+ insert into orchestral_sections (name)+ values ('woodwinds') returning id)- insert into cities (name, country_id) values- ('London', (select id from country)),- ('Manchester', (select id from country)),- ('Liverpool', (select id from country)),- ('Bristol', (select id from country));+ insert into instruments (name, section_id) values+ ('flute', (select id from section)),+ ('clarinet', (select id from section)),+ ('bassoon', (select id from section)),+ ('piccolo', (select id from section));```response: |```json{"data": [{- "name": "Bali",- "countries": {"name": "Indonesia"}+ "name": "flute",+ "orchestral_sections": {"name": "woodwinds"}}],"status": 200,@@ -3715,7 +3716,7 @@ functions:```description: |If you don't want to return the referenced table contents, you can leave the parenthesis empty.- Like `.select('name, countries!inner()')`.+ Like `.select('name, orchestral_sections!inner()')`.hideCodeBlock: true- id: switching-schemas-per-queryname: Switching schemas per query@@ -3766,7 +3767,7 @@ functions:```tsconst { error } = await supabase.from('countries')- .insert({ id: 1, name: 'Denmark' })+ .insert({ id: 1, name: 'Mordor' })```data:sql: |@@ -3789,7 +3790,7 @@ functions:```tsconst { data, error } = await supabase.from('countries')- .insert({ id: 1, name: 'Denmark' })+ .insert({ id: 1, name: 'Mordor' }).select()```data:@@ -3804,7 +3805,7 @@ functions:"data": [{"id": 1,- "name": "Denmark"+ "name": "Mordor"}],"status": 201,@@ -3819,8 +3820,8 @@ functions:const { error } = await supabase.from('countries').insert([- { id: 1, name: 'Nepal' },- { id: 1, name: 'Vietnam' },+ { id: 1, name: 'Mordor' },+ { id: 1, name: 'The Shire' },])```data:@@ -3858,20 +3859,20 @@ functions:code: |```tsconst { error } = await supabase- .from('countries')- .update({ name: 'Australia' })+ .from('instruments')+ .update({ name: 'piano' }).eq('id', 1)```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Taiwan');+ (1, 'harpsichord');```response: |```json@@ -3887,8 +3888,8 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')- .update({ name: 'Australia' })+ .from('instruments')+ .update({ name: 'piano' }).eq('id', 1).select()```@@ -3896,12 +3897,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Taiwan');+ (1, 'harpsichord');```response: |```json@@ -3909,7 +3910,7 @@ functions:"data": [{"id": 1,- "name": "Australia"+ "name": "piano"}],"status": 200,@@ -3980,20 +3981,20 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Albania' })+ .from('instruments')+ .upsert({ id: 1, name: 'piano' }).select()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json@@ -4001,7 +4002,7 @@ functions:"data": [{"id": 1,- "name": "Albania"+ "name": "piano"}],"status": 201,@@ -4015,10 +4016,10 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('instruments').upsert([- { id: 1, name: 'Albania' },- { id: 2, name: 'Algeria' },+ { id: 1, name: 'piano' },+ { id: 2, name: 'harp' },]).select()```@@ -4026,12 +4027,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json@@ -4039,11 +4040,11 @@ functions:"data": [{"id": 1,- "name": "Albania"+ "name": "piano"},{"id": 2,- "name": "Algeria"+ "name": "harp"}],"status": 201,@@ -4128,7 +4129,7 @@ functions:insert intocountries (id, name)values- (1, 'Spain');+ (1, 'Mordor');```response: |```json@@ -4159,7 +4160,7 @@ functions:insert intocountries (id, name)values- (1, 'Spain');+ (1, 'Mordor');```response: |```json@@ -4167,7 +4168,7 @@ functions:"data": [{"id": 1,- "name": "Spain"+ "name": "Mordor"}],"status": 200,@@ -4194,7 +4195,7 @@ functions:insert intocountries (id, name)values- (1, 'Spain'), (2, 'France'), (3, 'Germany');+ (1, 'Rohan'), (2, 'The Shire'), (3, 'Mordor');```response: |```json@@ -4311,8 +4312,8 @@ functions:insert intocountries (id, name)values- (1, 'France'),- (2, 'United Kingdom');+ (1, 'Rohan'),+ (2, 'The Shire');create function list_stored_countries() returns setof countries as $$select * from countries;@@ -4323,7 +4324,7 @@ functions:{"data": {"id": 1,- "name": "France"+ "name": "Rohan"},"status": 200,"statusText": "OK"@@ -4373,14 +4374,14 @@ functions:code: |```tsconst { data, error } = await supabase- .from('cities')- .select('name, country_id')- .eq('name', 'The Shire') // Correct+ .from('instruments')+ .select('name, section_id')+ .eq('name', 'violin') // Correctconst { data, error } = await supabase- .from('cities')- .eq('name', 'The Shire') // Incorrect- .select('name, country_id')+ .from('instruments')+ .eq('name', 'violin') // Incorrect+ .select('name, section_id')```- id: chaining-filtersname: Chaining@@ -4485,47 +4486,47 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('orchestral_sections').select(`name,- cities!inner (+ instruments!inner (name)`)- .eq('cities.name', 'Bali')+ .eq('instruments.name', 'flute')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "characters": [{- "name": "Bali"+ "name": "flute"}]}@@ -4547,22 +4548,22 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select()- .eq('name', 'Albania')+ .eq('name', 'Leia')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -4570,7 +4571,7 @@ functions:"data": [{"id": 2,- "name": "Albania"+ "name": "Leia"}],"status": 200,@@ -4588,22 +4589,22 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select()- .neq('name', 'Albania')+ .neq('name', 'Leia')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -4611,11 +4612,11 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "Luke"},{"id": 3,- "name": "Algeria"+ "name": "Han"}],"status": 200,@@ -4633,7 +4634,7 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select().gt('id', 2)```@@ -4641,14 +4642,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -4656,7 +4657,7 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Han"}],"status": 200,@@ -4677,7 +4678,7 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select().gte('id', 2)```@@ -4685,14 +4686,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -4700,11 +4701,11 @@ functions:"data": [{"id": 2,- "name": "Albania"+ "name": "Leia"},{"id": 3,- "name": "Algeria"+ "name": "Han"}],"status": 200,@@ -4722,7 +4723,7 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select().lt('id', 2)```@@ -4730,14 +4731,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -4745,7 +4746,7 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "Luke"}],"status": 200,@@ -4763,7 +4764,7 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select().lte('id', 2)```@@ -4771,14 +4772,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -4786,11 +4787,11 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "Luke"},{"id": 2,- "name": "Albania"+ "name": "Leia"}],"status": 200,@@ -4808,30 +4809,30 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select()- .like('name', '%Alba%')+ .like('name', '%Lu%')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "id": 2,- "name": "Albania"+ "id": 1,+ "name": "Luke"}],"status": 200,@@ -4849,30 +4850,30 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select()- .ilike('name', '%alba%')+ .ilike('name', '%lu%')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "id": 2,- "name": "Albania"+ "id": 1,+ "name": "Luke"}],"status": 200,@@ -4935,22 +4936,22 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select()- .in('name', ['Albania', 'Algeria'])+ .in('name', ['Leia', 'Han'])```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -4958,11 +4959,11 @@ functions:"data": [{"id": 2,- "name": "Albania"+ "name": "Leia"},{"id": 3,- "name": "Algeria"+ "name": "Han"}],"status": 200,@@ -5671,29 +5672,29 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select('name')- .match({ id: 2, name: 'Albania' })+ .match({ id: 2, name: 'Leia' })```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "name": "Albania"+ "name": "Leia"}],"status": 200,@@ -5765,32 +5766,32 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select('name')- .or('id.eq.2,name.eq.Algeria')+ .or('id.eq.2,name.eq.Han')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "name": "Albania"+ "name": "Luke"},{- "name": "Algeria"+ "name": "Leia"}],"status": 200,@@ -5804,29 +5805,29 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select('name')- .or('id.gt.3,and(id.eq.1,name.eq.Afghanistan)')+ .or('id.gt.3,and(id.eq.1,name.eq.Luke)')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```reponse: |```json{"data": [{- "name": "Afghanistan"+ "name": "Luke"}],"status": 200,@@ -5839,47 +5840,47 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('orchestral_sections').select(`name,- cities!inner (+ instruments!inner (name)`)- .or('country_id.eq.1,name.eq.Beijing', { referencedTable: 'cities' })+ .or('section_id.eq.1,name.eq.guzheng', { referencedTable: 'instruments' })```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Germany",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Munich"+ "name": "violin"}]}@@ -5906,22 +5907,22 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select()- .filter('name', 'in', '("Algeria","Japan")')+ .filter('name', 'in', '("Han","Yoda")')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -5929,7 +5930,7 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Han"}],"status": 200,@@ -5943,47 +5944,47 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('orchestral_sections').select(`name,- cities!inner (+ instruments!inner (name)`)- .filter('cities.name', 'eq', 'Bali')+ .filter('instruments.name', 'eq', 'flute')```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "instruments":{- "name": "Bali"+ "name": "flute"}]}@@ -6014,20 +6015,20 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Algeria' })+ .from('characters')+ .upsert({ id: 1, name: 'Han Solo' }).select()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan');+ (1, 'Han');```response: |```json@@ -6035,7 +6036,7 @@ functions:"data": [{"id": 1,- "name": "Algeria"+ "name": "Han Solo"}],"status": 201,@@ -6053,7 +6054,7 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select('id', 'name').order('id', { ascending: false })```@@ -6061,14 +6062,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -6076,15 +6077,15 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Han"},{"id": 2,- "name": "Albania"+ "name": "Leia"},{"id": 1,- "name": "Afghanistan"+ "name": "Luke"}],"status": 200,@@ -6098,56 +6099,56 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('orchestral_sections').select(`name,- cities (+ instruments (name)`)- .order('name', { referencedTable: 'cities', ascending: false })+ .order('name', { referencedTable: 'instruments', ascending: false })```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States'),- (2, 'Vanuatu');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "United States",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "New York City"+ "name": "violin"},{- "name": "Atlanta"+ "name": "harp"}]},{- "name": "Vanuatu",- "cities": []+ "name": "woodwinds",+ "characters": []}],"status": 200,@@ -6163,49 +6164,49 @@ functions:code: |```tsconst { data, error } = await supabase- .from('cities')+ .from('instruments').select(`name,- country:countries (+ section:orchestral_sections (name)`)- .order('country(name)', { ascending: true })+ .order('section(name)', { ascending: true })```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Munich'),- (2, 2, 'Bali');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Munich",- "country": { "name": "Germany" }+ "name": "violin",+ "orchestral_sections": {"name": "strings"}},{- "name": "Bali",- "country": { "name": "Indonesia" }+ "name": "flute",+ "orchestral_sections": {"name": "woodwinds"}}],"status": 200,@@ -6226,7 +6227,7 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select('name').limit(1)```@@ -6234,21 +6235,21 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Luke"}],"status": 200,@@ -6262,46 +6263,46 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('orchestral_sections').select(`name,- cities (+ instruments (name)`)- .limit(1, { referencedTable: 'cities' })+ .limit(1, { referencedTable: 'instruments' })```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States');+ (1, 'strings');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "United States",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Atlanta"+ "name": "violin"}]}@@ -6328,24 +6329,24 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Luke"},{- "name": "Albania"+ "name": "Leia"}],"status": 200,@@ -6421,7 +6422,7 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select('name').limit(1).single()@@ -6430,20 +6431,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": {- "name": "Afghanistan"+ "name": "Luke"},"status": 200,"statusText": "OK"@@ -6460,23 +6461,23 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select()- .eq('name', 'Singapore')+ .eq('name', 'Katniss').maybeSingle()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -6497,7 +6498,7 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select().csv()```@@ -6505,19 +6506,19 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{- "data": "id,name\n1,Afghanistan\n2,Albania\n3,Algeria",+ "data": "id,name\n1,Luke\n2,Leia\n3,Han","status": 200,"statusText": "OK"}@@ -6564,7 +6565,7 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select().explain()```@@ -6572,20 +6573,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```Aggregate (cost=33.34..33.36 rows=1 width=112)-> Limit (cost=0.00..18.33 rows=1000 width=40)- -> Seq Scan on countries (cost=0.00..22.00 rows=1200 width=40)+ -> Seq Scan on characters (cost=0.00..22.00 rows=1200 width=40)```description: |By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.@@ -6597,7 +6598,7 @@ functions:code: |```tsconst { data, error } = await supabase- .from('countries')+ .from('characters').select().explain({analyze:true,verbose:true})```@@ -6605,23 +6606,23 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```Aggregate (cost=33.34..33.36 rows=1 width=112) (actual time=0.041..0.041 rows=1 loops=1)- Output: NULL::bigint, count(ROW(countries.id, countries.name)), COALESCE(json_agg(ROW(countries.id, countries.name)), '[]'::json), NULLIF(current_setting('response.headers'::text, true), ''::text), NULLIF(current_setting('response.status'::text, true), ''::text)+ Output: NULL::bigint, count(ROW(characters.id, characters.name)), COALESCE(json_agg(ROW(characters.id, characters.name)), '[]'::json), NULLIF(current_setting('response.headers'::text, true), ''::text), NULLIF(current_setting('response.status'::text, true), ''::text)-> Limit (cost=0.00..18.33 rows=1000 width=40) (actual time=0.005..0.006 rows=3 loops=1)- Output: countries.id, countries.name- -> Seq Scan on public.countries (cost=0.00..22.00 rows=1200 width=40) (actual time=0.004..0.005 rows=3 loops=1)- Output: countries.id, countries.name+ Output: characters.id, characters.name+ -> Seq Scan on public.characters (cost=0.00..22.00 rows=1200 width=40) (actual time=0.004..0.005 rows=3 loops=1)+ Output: characters.id, characters.nameQuery Identifier: -4730654291623321173Planning Time: 0.407 msExecution Time: 0.119 ms@@ -6658,7 +6659,7 @@ functions:# insert into# countries (id, name)# values- # (1, 'Spain');+ # (1, 'Mordor');# ```# </details>@@ -6695,7 +6696,7 @@ functions:# "data": [# {# "id": 1,- # "name": "Spain"+ # "name": "Mordor"# }# ],# "status": 200,diff --git a/apps/docs/spec/supabase_kt_v1.yml b/apps/docs/spec/supabase_kt_v1.ymlindex 18cd95d0477..0758a277578 100644--- a/apps/docs/spec/supabase_kt_v1.yml+++ b/apps/docs/spec/supabase_kt_v1.yml@@ -408,14 +408,14 @@ functions:isSpotlight: truecode: |```kotlin- supabase.postgrest["countries"].update(+ supabase.postgrest["characters"].update({- Country::name setTo "Australia"+ Character::name setTo "Han Solo"//or- set("name", "Australia")+ set("name", "Han Solo")}) {- Country::id eq 1+ Character::id eq 1//oreq("id", 1)}@@ -424,28 +424,28 @@ functions:name: Update a record and return itcode: |```kotlin- val newCountry = supabase.postgrest["countries"].update(+ val newCharacter = supabase.postgrest["characters"].update({- Country::name setTo "Australia"+ Character::name setTo "Han Solo"//or- set("name", "Australia")+ set("name", "Han Solo")}) {- Country::id eq 1+ Character::id eq 1//oreq("id", 1)- }.decodeSingle<Country>()+ }.decodeSingle<Character>()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Taiwan');+ (1, 'Han');```response: |```json@@ -453,7 +453,7 @@ functions:"data": [{"id": 1,- "name": "Australia"+ "name": "Han Solo"}],"status": 200,@@ -620,14 +620,14 @@ functions:`delete()`, and `rpc()`code: |```kotlin- supabase.postgrest["cities"].select(columns = Columns.list("name, country_id")) {+ supabase.postgrest["characters"].select(columns = Columns.list("name, book_id")) {and { //when both are true- City::population gt 40000- City::population lt 700000+ Character::age gt 10+ Character::age lt 150}or { //when either one of the filters are true- City::name eq "London"- City::name eq "Berlin"+ Character::name eq "Harry"+ Character::name eq "Dumbledore"}}```@@ -677,49 +677,49 @@ functions:name: Filter Foreign Tablescode: |```kotlin- supabase.postgrest["countries"].select(+ supabase.postgrest["orchestral_sections"].select(columns = Columns.raw("""name,- cities!inner (+ instruments!inner (name)""")) {- eq("cities.name", "Bali")+ eq("instruments.name", "flute")}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "characters": [{- "name": "Bali"+ "name": "flute"}]}@@ -742,10 +742,10 @@ functions:supabase.postgrest["countries"].select(columns = Columns.list("name")) {or {Country::id eq 2- Country::name eq "Algeria"+ Country::name eq "Mordor"//oreq("id", 2)- eq("name", "Algeria")+ eq("name", "Mordor")}}```@@ -758,7 +758,7 @@ functions:Country::id gt 3and {Country::id eq 1- Country::name eq "Afghanistan"+ Country::name eq "Mordor"}}}@@ -803,9 +803,9 @@ functions:```kotlinval toUpdate = City(name = "Mordor")supabase.postgrest["cities"].update(toUpdate) {- City::name eq "San Francisco"+ City::name eq "The Shire"//or- eq("name", "San Francisco")+ eq("name", "The Shire")}```- id: with-delete@@ -1224,9 +1224,9 @@ functions:code: |```kotlinsupabase.postgrest["cities"].select(columns = Columns.list("name")) {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("The Shire", "Mordor")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("The Shire", "Mordor"))}```- id: with-update@@ -1235,9 +1235,9 @@ functions:```kotlinval toUpdate = City(name = "Mordor")supabase.postgrest["cities"].update(toUpdate) {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}```- id: with-delete@@ -1245,9 +1245,9 @@ functions:code: |```kotlinsupabase.postgrest["cities"].delete {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}```- id: with-rpc@@ -1255,9 +1255,9 @@ functions:code: |```kotlinsupabase.postgrest.rpc("echo_all_cities") {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}```@@ -1728,22 +1728,22 @@ functions:name: With `select()`code: |```kotlin- supabase.postgrest["countries"].select {- filter(column = "name", operator = FilterOperator.IN, value = "('Algeria', 'Japan')")+ supabase.postgrest["characters"].select {+ filter(column = "name", operator = FilterOperator.IN, value = "('Han', 'Katniss')")}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -1751,7 +1751,7 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Han"}],"status": 200,@@ -1764,49 +1764,49 @@ functions:name: On a foreign tablecode: |```kotlin- supabase.postgrest["countries"].select(+ supabase.postgrest["orchestral_sections"].select(columns = Columns.raw("""name,- cities!inner (+ instruments!inner (name)""")) {- filter(column = "cities.name", operator = FilterOperator.EQ, value = "Bali")+ filter(column = "instruments.name", operator = FilterOperator.EQ, value = "flute")}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "instruments": [{- "name": "Bali"+ "name": "flute"}]}@@ -1826,22 +1826,22 @@ functions:name: With `select()`code: |```kotlin- supabase.postgrest["countries"].select(columns = Columns.list("id", "name")) {- order(column = "id", order = Order.ASCENDING)+ supabase.postgrest["characters"].select(columns = Columns.list("id", "name")) {+ order(column = "id", order = Order.DESCENDING)}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -1849,15 +1849,15 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Han"},{"id": 2,- "name": "Albania"+ "name": "Leia"},{"id": 1,- "name": "Afghanistan"+ "name": "Luke"}],"status": 200,@@ -1870,60 +1870,60 @@ functions:name: On a foreign tablecode: |```kotlin- supabase.postgrest["countries"].select(+ supabase.postgrest["orchestral_sections"].select(columns = Columns.raw("""name,- cities (+ instruments (name)""")) {- order(column = "id", order = Order.ASCENDING, foreignTable = "cities")+ order(column = "name", order = Order.DESCENDING, foreignTable = "instruments")}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States'),- (2, 'Vanuatu');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "United States",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "New York City"+ "name": "violin"},{- "name": "Atlanta"+ "name": "harp"}]},{- "name": "Vanuatu",- "cities": []+ "name": "woodwinds",+ "instruments": []}],"status": 200,@@ -1945,29 +1945,29 @@ functions:name: With `select()`code: |```kotlin- supabase.postgrest["countries"].select {- limit(count = 20)+ supabase.postgrest["characters"].select {+ limit(count = 1)}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Luke"}],"status": 200,@@ -1980,50 +1980,50 @@ functions:name: On a foreign tablecode: |```kotlin- supabase.postgrest["countries"].select(+ supabase.postgrest["orchestral_sections"].select(columns = Columns.raw("""name,- cities (+ instruments (name)""")) {- limit(count = 20, foreignTable = "cities")+ limit(count = 1, foreignTable = "instruments")}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States');+ (1, 'strings');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "United States",+ "name": "strings","cities": [{- "name": "Atlanta"+ "name": "harp"}]}@@ -2042,7 +2042,7 @@ functions:name: With `select()`code: |```kotlin- supabase.postgrest["countries"].select {+ supabase.postgrest["characters"].select {range(1L..5L)}```@@ -2050,24 +2050,24 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Luke"},{- "name": "Albania"+ "name": "Leia"}],"status": 200,diff --git a/apps/docs/spec/supabase_kt_v2.yml b/apps/docs/spec/supabase_kt_v2.ymlindex 14ca08fb04f..e165f308df0 100644--- a/apps/docs/spec/supabase_kt_v2.yml+++ b/apps/docs/spec/supabase_kt_v2.yml@@ -28,16 +28,16 @@ functions:### OAuth and OTP link verification- [supabase-kt](https://github.com/supabase-community/supabase-kt) provides several platform implementations for OAuth and OTP link verification.+ [supabase-kt](https://github.com/supabase-community/supabase-kt) provides several platform implementations for OAuth and OTP link verification.**On Desktop platforms (JVM, MacOS\*, Linux)**, it uses a HTTP Callback Server to receive the session data from a successful OAuth login. The success page can be customized via `AuthConfig#httpCallbackConfig` \\* If no deeplinks are being used.- *Note: OTP link verification such as sign ups are not supported on JVM. You may have to send a verification token rather than a url in your email. To send the token, rather than a redirect url, change `{{ .ConfirmationURL }}` in your sign up email to `{{ .Token }}`*+ *Note: OTP link verification such as sign ups are not supported on JVM. You may have to send a verification token rather than a url in your email. To send the token, rather than a redirect url, change `{{ .ConfirmationURL }}` in your sign up email to `{{ .Token }}`***On Android, iOS & MacOS**, OAuth and OTP verification use deeplinks. Refer to the guide below on how to setup deeplinks. Alternatively you can use [Native Google Auth](/docs/guides/auth/social-login/auth-google?platform=android). \**On JS**, it uses the website origin as the callback url. Session importing gets handled automatically. \- **Windows, tvOS, watchOS & Linux** currently have no default implementation. Feel free to create a PR.+ **Windows, tvOS, watchOS & Linux** currently have no default implementation. Feel free to create a PR.You always make your own implementation and use `auth.parseSessionFromFragment(fragment)` or `auth.parseSessionFromUrl(url)` to let [supabase-kt](https://github.com/supabase-community/supabase-kt) handle the parsing after receiving a callback.Then you can simply use `auth.importSession(session)`.@@ -449,8 +449,8 @@ functions:code: |```kotlinval city = City(name = "The Shire", countryId = 554)- val result = supabase.from("cities").insert(city) {- select()+ val result = supabase.from("cities").insert(city) {+ select()}.decodeSingle<City>()```- id: bulk-create@@ -487,15 +487,15 @@ functions:isSpotlight: truecode: |```kotlin- supabase.from("countries").update(+ supabase.from("characters").update({- Country::name setTo "Australia"+ Character::name setTo "Harry"//or- set("name", "Australia")+ set("name", "Harry")}) {filter {- Country::id eq 1+ Character::id eq 1//oreq("id", 1)}@@ -505,31 +505,31 @@ functions:name: Update a record and return itcode: |```kotlin- val newCountry = supabase.from("countries").update(+ val newInstrument = supabase.from("instruments").update({- Country::name setTo "Australia"+ Instrument::name setTo "piano"//or- set("name", "Australia")+ set("name", "piano")}) {select()filter {- Country::id eq 1+ Instrument::id eq 1//oreq("id", 1)}- }.decodeSingle<Country>()+ }.decodeSingle<Instrument>()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Australia');+ (1, 'harpsichord');```response: |```json@@ -537,7 +537,7 @@ functions:"data": [{"id": 1,- "name": "Australia"+ "name": "harpsichord"}],"status": 200,@@ -777,8 +777,8 @@ functions:City::population lt 700000}or { //when either one of the filters are true- City::name eq "London"- City::name eq "Berlin"+ City::name eq "Hobbiton"+ City::name eq "Edoras"}}}@@ -841,7 +841,7 @@ functions:columns = columns) {filter {- eq("cities.name", "Bali")+ eq("cities.name", "Hobbiton")}}```@@ -860,23 +860,23 @@ functions:insert intocountries (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'Gondor'),+ (2, 'The Shire');insert intocities (id, country_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'Hobbiton'),+ (2, 1, 'Minas Tirith');```response: |```json{"data": [{- "name": "Indonesia",+ "name": "The Shire","cities": [{- "name": "Bali"+ "name": "Hobbiton"}]}@@ -908,10 +908,10 @@ functions:filter {or {Country::id eq 2- Country::name eq "Algeria"+ Country::name eq "The Shire"//oreq("id", 2)- eq("name", "Algeria")+ eq("name", "The Shire")}}}@@ -926,7 +926,7 @@ functions:Country::id gt 3and {Country::id eq 1- Country::name eq "Afghanistan"+ Country::name eq "The Shire"}}}@@ -999,9 +999,9 @@ functions:val toUpdate = City(name = "Mordor")supabase.from("cities").update(toUpdate) {filter {- City::name eq "San Francisco"+ City::name eq "Hobbiton"//or- eq("name", "San Francisco")+ eq("name", "Hobbiton")}}```@@ -1571,9 +1571,9 @@ functions:```kotlinsupabase.from("cities").select(columns = Columns.list("name")) {filter {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}}```@@ -1584,9 +1584,9 @@ functions:val toUpdate = City(name = "Mordor")supabase.from("cities").update(toUpdate) {filter {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}}```@@ -1596,9 +1596,9 @@ functions:```kotlinsupabase.from("cities").delete {filter {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}}```@@ -1608,9 +1608,9 @@ functions:```kotlinsupabase.postgrest.rpc("echo_all_cities") {filter {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}}```@@ -2216,24 +2216,24 @@ functions:name: With `select()`code: |```kotlin- supabase.from("countries").select {+ supabase.from("characters").select {filter {- filter(column = "name", operator = FilterOperator.IN, value = "('Algeria', 'Japan')")- }+ filter(column = "name", operator = FilterOperator.IN, value = "('Han', 'Katniss')")+ }}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -2241,7 +2241,7 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Han"}],"status": 200,@@ -2256,15 +2256,15 @@ functions:```kotlinval columns = Columns.raw("""name,- cities!inner (+ instruments!inner (name)""".trimIndent())- supabase.from("countries").select(+ supabase.from("orchestral_sections").select(columns = columns) {filter {- filter(column = "cities.name", operator = FilterOperator.EQ, value = "Bali")+ filter(column = "instruments.name", operator = FilterOperator.EQ, value = "flute")}}```@@ -2272,34 +2272,34 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "instruments": [{- "name": "Bali"+ "name": "flute"}]}@@ -2333,21 +2333,21 @@ functions:name: With `upsert()`code: |```kotlin- val toUpsert = Country(id = 2, name = "Algeria")- val count = supabase.from("countries").upsert(toUpsert) {+ val toUpsert = Character(id = 2, name = "Leia")+ val count = supabase.from("characters").upsert(toUpsert) {select()- }.decodeSingle<Country>()+ }.decodeSingle<Character>()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan');+ (1, 'Luke');```response: |```json@@ -2355,7 +2355,7 @@ functions:"data": [{"id": 2,- "name": "Algeria"+ "name": "Leia"}],"status": 201,@@ -2391,22 +2391,22 @@ functions:name: With `select()`code: |```kotlin- supabase.from("countries").select(columns = Columns.list("id", "name")) {- order(column = "id", order = Order.ASCENDING)+ supabase.from("characters").select(columns = Columns.list("id", "name")) {+ order(column = "id", order = Order.DESCENDING)}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -2414,15 +2414,15 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Han"},{"id": 2,- "name": "Albania"+ "name": "Leia"},{"id": 1,- "name": "Afghanistan"+ "name": "Luke"}],"status": 200,@@ -2437,57 +2437,57 @@ functions:```kotlinval columns = Columns.raw("""name,- cities (+ instruments (name)""".trimIndent())- supabase.from("countries").select(+ supabase.from("orchestral_sections").select(columns = columns) {- order(column = "id", order = Order.ASCENDING, referencedTable = "cities")+ order(column = "id", order = Order.DESCENDING, referencedTable = "instruments")}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States'),- (2, 'Vanuatu');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "United States",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "New York City"+ "name": "violin"},{- "name": "Atlanta"+ "name": "harp"}]},{- "name": "Vanuatu",- "cities": []+ "name": "woodwinds",+ "instruments": []}],"status": 200,@@ -2526,21 +2526,21 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Luke"}],"status": 200,@@ -2555,47 +2555,47 @@ functions:```kotlinval columns = Columns.raw("""name,- cities (+ instruments (name)""")- supabase.from("countries").select(+ supabase.from("orchestral_sections").select(columns = columns) {- limit(count = 1, referencedTable = "cities")+ limit(count = 1, referencedTable = "instruments")}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States');+ (1, 'strings');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "United States",+ "name": "strings","cities": [{- "name": "Atlanta"+ "name": "harp"}]}@@ -2627,7 +2627,7 @@ functions:name: With `select()`code: |```kotlin- supabase.from("countries").select {+ supabase.from("characters").select {range(1L..5L)}```@@ -2635,24 +2635,24 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Luke"},{- "name": "Albania"+ "name": "Leia"}],"status": 200,@@ -2669,7 +2669,7 @@ functions:name: With `select()`code: |```kotlin- val result = supabase.from("countries").select(Columns.list("name")) {+ val result = supabase.from("characters").select(Columns.list("name")) {limit(1)single()}@@ -2678,20 +2678,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": {- "name": "Afghanistan"+ "name": "Luke"},"status": 200,"statusText": "OK"@@ -2708,7 +2708,7 @@ functions:name: Return data as CSVcode: |```kotlin- val (csvData, _) = supabase.from("countries").select {+ val (csvData, _) = supabase.from("characters").select {csv()}```@@ -2716,19 +2716,19 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{- "data": "id,name\n1,Afghanistan\n2,Albania\n3,Algeria",+ "data": "id,name\n1,Luke\n2,Leia\n3,Han","status": 200,"statusText": "OK"}@@ -2779,7 +2779,7 @@ functions:name: Get the execution plancode: |```kotlin- val result = supabase.from("countries").select {+ val result = supabase.from("characters").select {explain()}```@@ -2787,20 +2787,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```Aggregate (cost=33.34..33.36 rows=1 width=112)-> Limit (cost=0.00..18.33 rows=1000 width=40)- -> Seq Scan on countries (cost=0.00..22.00 rows=1200 width=40)+ -> Seq Scan on characters (cost=0.00..22.00 rows=1200 width=40)```description: |By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.@@ -3284,7 +3284,7 @@ functions:title: 'Verify OTPs'$ref: '@supabase/gotrue-js.GoTrueClient.verifyOtp'notes: |- - Verifying an OTP is done through either `verifyPhoneOtp` or `verifyEmailOtp`.+ - Verifying an OTP is done through either `verifyPhoneOtp` or `verifyEmailOtp`.- The verification type used should be determined based on the corresponding auth method called before using `verifyPhoneOtp`/`verifyEmailOtp` to sign up / sign-in a user.params:- name: type@@ -3803,7 +3803,7 @@ functions:code: |```kotlinval factor = supabase.auth.mfa.enroll(factorType = FactorType.Phone, friendlyName = "Your friendly Name") {- phone = "+123456789"+ phone = "+123456789"}// Use the id to create a challenge and send an SMS with a code to the user.@@ -4591,7 +4591,7 @@ functions:}//if you want more control and want to receive the raw data, use the `presenceChangeFlow` method- val presenceFlow = channel.presenceDataFlow<PresenceState>()+ val presenceFlow = channel.presenceDataFlow<PresenceState>()//Collect the flowpresenceFlow.onEach {diff --git a/apps/docs/spec/supabase_kt_v3.yml b/apps/docs/spec/supabase_kt_v3.ymlindex 1ae14fe113c..76b31398e9a 100644--- a/apps/docs/spec/supabase_kt_v3.yml+++ b/apps/docs/spec/supabase_kt_v3.yml@@ -28,16 +28,16 @@ functions:### OAuth and OTP link verification- [supabase-kt](https://github.com/supabase-community/supabase-kt) provides several platform implementations for OAuth and OTP link verification.+ [supabase-kt](https://github.com/supabase-community/supabase-kt) provides several platform implementations for OAuth and OTP link verification.**On Desktop platforms (JVM, MacOS\*, Linux, Windows)**, it uses a HTTP Callback Server to receive the session data from a successful OAuth login. The success page can be customized via `AuthConfig#httpCallbackConfig` \\* If no deeplinks are being used.- *Note: OTP link verification such as sign ups are not supported on JVM. You may have to send a verification token rather than a url in your email. To send the token, rather than a redirect url, change `{{ .ConfirmationURL }}` in your sign up email to `{{ .Token }}`*+ *Note: OTP link verification such as sign ups are not supported on JVM. You may have to send a verification token rather than a url in your email. To send the token, rather than a redirect url, change `{{ .ConfirmationURL }}` in your sign up email to `{{ .Token }}`***On Android, iOS & MacOS**, OAuth and OTP verification use deeplinks. Refer to the guide below on how to setup deeplinks. Alternatively you can use [Native Google Auth](/docs/guides/auth/social-login/auth-google?platform=android). \**On JS**, it uses the website origin as the callback url. Session importing gets handled automatically. \- **tvOS & watchOS** currently have no default implementation. Feel free to create a PR.+ **tvOS & watchOS** currently have no default implementation. Feel free to create a PR.You always make your own implementation and use `auth.parseSessionFromFragment(fragment)` or `auth.parseSessionFromUrl(url)` to let [supabase-kt](https://github.com/supabase-community/supabase-kt) handle the parsing after receiving a callback.Then you can simply use `auth.importSession(session)`.@@ -449,8 +449,8 @@ functions:code: |```kotlinval city = City(name = "The Shire", countryId = 554)- val result = supabase.from("cities").insert(city) {- select()+ val result = supabase.from("cities").insert(city) {+ select()}.decodeSingle<City>()```- id: bulk-create@@ -487,15 +487,15 @@ functions:isSpotlight: truecode: |```kotlin- supabase.from("countries").update(+ supabase.from("characters").update({- Country::name setTo "Australia"+ Country::name setTo "Han Solo"//or- set("name", "Australia")+ set("name", "Han Solo")}) {filter {- Country::id eq 1+ Character::id eq 1//oreq("id", 1)}@@ -505,31 +505,31 @@ functions:name: Update a record and return itcode: |```kotlin- val newCountry = supabase.from("countries").update(+ val newCharacter = supabase.from("characters").update({- Country::name setTo "Australia"+ Character::name setTo "Han Solo"//or- set("name", "Australia")+ set("name", "Han Solo")}) {select()filter {- Country::id eq 1+ Character::id eq 1//oreq("id", 1)}- }.decodeSingle<Country>()+ }.decodeSingle<Character>()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Australia');+ (1, 'Han');```response: |```json@@ -537,7 +537,7 @@ functions:"data": [{"id": 1,- "name": "Australia"+ "name": "Han Solo"}],"status": 200,@@ -786,8 +786,8 @@ functions:City::population lt 700000}or { //when either one of the filters are true- City::name eq "London"- City::name eq "Berlin"+ City::name eq "Hobbiton"+ City::name eq "Edoras"}}}@@ -842,15 +842,15 @@ functions:```kotlinval columns = Columns.raw("""name,- cities!inner (+ instruments!inner (name)""".trimIndent())- supabase.from("countries").select(+ supabase.from("orchestral_sections").select(columns = columns) {filter {- eq("cities.name", "Bali")+ eq("instruments.name", "flute")}}```@@ -858,34 +858,34 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Bali"+ "name": "flute"}]}@@ -917,10 +917,10 @@ functions:filter {or {Country::id eq 2- Country::name eq "Algeria"+ Country::name eq "Mordor"//oreq("id", 2)- eq("name", "Algeria")+ eq("name", "Mordor")}}}@@ -935,7 +935,7 @@ functions:Country::id gt 3and {Country::id eq 1- Country::name eq "Afghanistan"+ Country::name eq "Mordor"}}}@@ -1008,9 +1008,9 @@ functions:val toUpdate = City(name = "Mordor")supabase.from("cities").update(toUpdate) {filter {- City::name eq "San Francisco"+ City::name eq "Hobbiton"//or- eq("name", "San Francisco")+ eq("name", "Hobbiton")}}```@@ -1580,9 +1580,9 @@ functions:```kotlinsupabase.from("cities").select(columns = Columns.list("name")) {filter {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}}```@@ -1593,9 +1593,9 @@ functions:val toUpdate = City(name = "Mordor")supabase.from("cities").update(toUpdate) {filter {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}}```@@ -1605,9 +1605,9 @@ functions:```kotlinsupabase.from("cities").delete {filter {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}}```@@ -1617,9 +1617,9 @@ functions:```kotlinsupabase.postgrest.rpc("echo_all_cities") {filter {- City::name isIn listOf("Rio de Janeiro", "San Francisco")+ City::name isIn listOf("Hobbiton", "Edoras")//or- isIn("name", listOf("Rio de Janeiro", "San Francisco"))+ isIn("name", listOf("Hobbiton", "Edoras"))}}```@@ -2225,24 +2225,24 @@ functions:name: With `select()`code: |```kotlin- supabase.from("countries").select {+ supabase.from("characters").select {filter {- filter(column = "name", operator = FilterOperator.IN, value = "('Algeria', 'Japan')")- }+ filter(column = "name", operator = FilterOperator.IN, value = "('Han', 'Katniss')")+ }}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -2250,7 +2250,7 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Han"}],"status": 200,@@ -2265,15 +2265,15 @@ functions:```kotlinval columns = Columns.raw("""name,- cities!inner (+ instruments!inner (name)""".trimIndent())- supabase.from("countries").select(+ supabase.from("orchestral_sections").select(columns = columns) {filter {- filter(column = "cities.name", operator = FilterOperator.EQ, value = "Bali")+ filter(column = "instruments.name", operator = FilterOperator.EQ, value = "flute")}}```@@ -2281,34 +2281,34 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'flute'),+ (2, 'violin');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 1, 'violin'),+ (2, 2, 'flute');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "instruments": [{- "name": "Bali"+ "name": "flute"}]}@@ -2342,7 +2342,7 @@ functions:name: With `upsert()`code: |```kotlin- val toUpsert = Country(id = 2, name = "Algeria")+ val toUpsert = Country(id = 2, name = "Mordor")val count = supabase.from("countries").upsert(toUpsert) {select()}.decodeSingle<Country>()@@ -2356,7 +2356,7 @@ functions:insert intocountries (id, name)values- (1, 'Afghanistan');+ (1, 'The Shire');```response: |```json@@ -2364,7 +2364,7 @@ functions:"data": [{"id": 2,- "name": "Algeria"+ "name": "Mordor"}],"status": 201,@@ -2400,22 +2400,22 @@ functions:name: With `select()`code: |```kotlin- supabase.from("countries").select(columns = Columns.list("id", "name")) {- order(column = "id", order = Order.ASCENDING)+ supabase.from("characters").select(columns = Columns.list("id", "name")) {+ order(column = "id", order = Order.DESCENDING)}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json@@ -2423,15 +2423,15 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Han"},{"id": 2,- "name": "Albania"+ "name": "Leia"},{"id": 1,- "name": "Afghanistan"+ "name": "Luke"}],"status": 200,@@ -2446,57 +2446,57 @@ functions:```kotlinval columns = Columns.raw("""name,- cities (+ instruments (name)""".trimIndent())- supabase.from("countries").select(+ supabase.from("orchestral_sections").select(columns = columns) {- order(column = "id", order = Order.ASCENDING, referencedTable = "cities")+ order(column = "id", order = Order.DESCENDING, referencedTable = "instruments")}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States'),- (2, 'Vanuatu');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "United States",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "New York City"+ "name": "violin"},{- "name": "Atlanta"+ "name": "harp"}]},{- "name": "Vanuatu",- "cities": []+ "name": "woodwinds",+ "instruments": []}],"status": 200,@@ -2513,48 +2513,48 @@ functions:```kotlinval columns = Columns.raw("""name,- country:countries(name)+ section:orchestral_sections(name)""".trimIndent())- supabase.from("cities").select(+ supabase.from("instruments").select(columns = columns) {- order(column = "country(name)", order = Order.ASCENDING)+ order(column = "orchestral_sections(name)", order = Order.ASCENDING)}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Munich'),- (2, 2, 'Bali');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Munich",- "country": { "name": "Germany" }+ "name": "violin",+ "section": { "name": "strings" }},{- "name": "Bali",- "country": { "name": "Indonesia" }+ "name": "flute",+ "section": { "name": "woodwinds" }}],"status": 200,@@ -2585,7 +2585,7 @@ functions:name: With `select()`code: |```kotlin- supabase.from("countries").select {+ supabase.from("characters").select {limit(count = 1)}```@@ -2593,21 +2593,21 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Luke"}],"status": 200,@@ -2622,47 +2622,47 @@ functions:```kotlinval columns = Columns.raw("""name,- cities (+ instruments (name)""")- supabase.from("countries").select(+ supabase.from("orchestral_sections").select(columns = columns) {- limit(count = 1, referencedTable = "cities")+ limit(count = 1, referencedTable = "instruments")}```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States');+ (1, 'strings');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "United States",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Atlanta"+ "name": "harp"}]}@@ -2694,7 +2694,7 @@ functions:name: With `select()`code: |```kotlin- supabase.from("countries").select {+ supabase.from("characters").select {range(1L..5L)}```@@ -2702,24 +2702,24 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Luke"},{- "name": "Albania"+ "name": "Leia"}],"status": 200,@@ -2736,7 +2736,7 @@ functions:name: With `select()`code: |```kotlin- val result = supabase.from("countries").select(Columns.list("name")) {+ val result = supabase.from("characters").select(Columns.list("name")) {limit(1)single()}@@ -2745,20 +2745,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{"data": {- "name": "Afghanistan"+ "name": "Luke"},"status": 200,"statusText": "OK"@@ -2775,7 +2775,7 @@ functions:name: Return data as CSVcode: |```kotlin- val (csvData, _) = supabase.from("countries").select {+ val (csvData, _) = supabase.from("characters").select {csv()}```@@ -2783,19 +2783,19 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```json{- "data": "id,name\n1,Afghanistan\n2,Albania\n3,Algeria",+ "data": "id,name\n1,Luke\n2,Leia\n3,Han","status": 200,"statusText": "OK"}@@ -2846,7 +2846,7 @@ functions:name: Get the execution plancode: |```kotlin- val result = supabase.from("countries").select {+ val result = supabase.from("characters").select {explain()}```@@ -2854,20 +2854,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Luke'),+ (2, 'Leia'),+ (3, 'Han');```response: |```Aggregate (cost=33.34..33.36 rows=1 width=112)-> Limit (cost=0.00..18.33 rows=1000 width=40)- -> Seq Scan on countries (cost=0.00..22.00 rows=1200 width=40)+ -> Seq Scan on characters (cost=0.00..22.00 rows=1200 width=40)```description: |By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.@@ -3351,7 +3351,7 @@ functions:title: 'Verify OTPs'$ref: '@supabase/gotrue-js.GoTrueClient.verifyOtp'notes: |- - Verifying an OTP is done through either `verifyPhoneOtp` or `verifyEmailOtp`.+ - Verifying an OTP is done through either `verifyPhoneOtp` or `verifyEmailOtp`.- The verification type used should be determined based on the corresponding auth method called before using `verifyPhoneOtp`/`verifyEmailOtp` to sign up / sign-in a user.params:- name: type@@ -3870,7 +3870,7 @@ functions:code: |```kotlinval factor = supabase.auth.mfa.enroll(factorType = FactorType.Phone, friendlyName = "Your friendly Name") {- phone = "+123456789"+ phone = "+123456789"}// Use the id to create a challenge and send an SMS with a code to the user.@@ -4658,7 +4658,7 @@ functions:}//if you want more control and want to receive the raw data, use the `presenceChangeFlow` method- val presenceFlow = channel.presenceDataFlow<PresenceState>()+ val presenceFlow = channel.presenceDataFlow<PresenceState>()//Collect the flowpresenceFlow.onEach {diff --git a/apps/docs/spec/supabase_py_v2.yml b/apps/docs/spec/supabase_py_v2.ymlindex ba8abf41f28..f6c307135f4 100644--- a/apps/docs/spec/supabase_py_v2.yml+++ b/apps/docs/spec/supabase_py_v2.yml@@ -167,7 +167,7 @@ functions:- id: signupname: Sign up with an email and passwordcode: |- ```python+ ```pythonresponse = supabase.auth.sign_up({"email": "[email protected]", "password": "password"})@@ -1410,7 +1410,7 @@ functions:# retrieve all identites linked to a userres = supabase.auth.get_user_identities()- # find the google identity+ # find the google identitygoogle_identity = list(filter(lambda identity: identity.provider == "google", res.identities)).pop()@@ -1983,7 +1983,7 @@ functions:from supabase.lib.client_options import ClientOptionssupabase = create_client(- supabase_url,+ supabase_url,service_role_key,options=ClientOptions(auto_refresh_token=False,@@ -2727,20 +2727,20 @@ functions:name: Getting your datacode: |```python- response = supabase.table("countries").select("*").execute()+ response = supabase.table("planets").select("*").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -2748,15 +2748,15 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "Mercury"},{"id": 2,- "name": "Albania"+ "name": "Earth"},{"id": 3,- "name": "Algeria"+ "name": "Mars"}],"count": null@@ -2766,33 +2766,33 @@ functions:name: Selecting specific columnscode: |```- response = supabase.table("countries").select("name").execute()+ response = supabase.table("planets").select("name").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Mercury"},{- "name": "Albania"+ "name": "Earth"},{- "name": "Algeria"+ "name": "Mars"}],"count": null@@ -2804,48 +2804,48 @@ functions:If your database has foreign key relationships, you can query related tables too.code: |```python- response = supabase.table("countries").select("name, cities(name)").execute()+ response = supabase.table("orchestral_sections").select("name, instruments(name)").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Germany",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Munich"+ "name": "violin"}]},{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "instruments": [{- "name": "Bali"+ "name": "flute"}]}@@ -2992,9 +2992,9 @@ functions:code: |```pythonresponse = (- supabase.table("cities")- .select("name, countries(*)")- .eq("countries.name", "Estonia")+ supabase.table("orchestral_sections")+ .select("name, instruments(*)")+ .eq("instruments.name", "guqin").execute())```@@ -3002,36 +3002,36 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Bali",- "countries": null+ "name": "strings",+ "instruments": null},{- "name": "Munich",- "countries": null+ "name": "woodwinds",+ "instruments": null}],"count": null@@ -3046,31 +3046,31 @@ functions:name: Querying referenced table with countcode: |```python- response = supabase.table("countries").select("*, cities(count)").execute()+ response = supabase.table("orchestral_sections").select("*, instruments(count)").execute()```data:sql: |```sql- create table countries (+ create table orchestral_sections ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text);- create table cities (+ create table instruments ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text,- "country_id" "uuid" references public.countries on delete cascade+ "section_id" "uuid" references public.orchestral_sections on delete cascade);- with country as (- insert into countries (name)- values ('united kingdom') returning id+ with section as (+ insert into orchestral_sections (name)+ values ('strings') returning id)- insert into cities (name, country_id) values- ('London', (select id from country)),- ('Manchester', (select id from country)),- ('Liverpool', (select id from country)),- ('Bristol', (select id from country));+ insert into instruments (name, section_id) values+ ('violin', (select id from section)),+ ('viola', (select id from section)),+ ('cello', (select id from section)),+ ('double bass', (select id from section));```response: |```json@@ -3078,8 +3078,8 @@ functions:"data": [{"id": "c31e7151-5a6f-453c-915b-caf31ec9a0a0",- "name": "united kingdom",- "cities": [+ "name": "strings",+ "instruments": [{"count": 4}@@ -3097,20 +3097,20 @@ functions:name: Querying with count optioncode: |```python- response = supabase.table("countries").select("*", count="exact").execute()+ response = supabase.table("planets").select("*", count="exact").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -3118,15 +3118,15 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "Mercury"},{"id": 2,- "name": "Albania"+ "name": "Earth"},{"id": 3,- "name": "Algeria"+ "name": "Mars"}],"count": 3@@ -3181,9 +3181,9 @@ functions:code: |```pythonresponse = (- supabase.table("cities")- .select("name, countries!inner(name)")- .eq("countries.name", "Indonesia")+ supabase.table("instruments")+ .select("name, orchestral_sections!inner(name)")+ .eq("orchestral_sections.name", "woodwinds").execute())```@@ -3191,33 +3191,33 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Bali",- "countries": {- "name": "Indonesia"+ "name": "flute",+ "orchestral_sections": {+ "name": "woodwinds"}}],@@ -3226,7 +3226,7 @@ functions:```description: |If you don't want to return the referenced table contents, you can leave the parenthesis empty.- Like `.select('name, countries!inner()')`.+ Like `.select('name, orchestral_sections!inner()')`.hideCodeBlock: true- id: switching-schemas-per-queryname: Switching schemas per query@@ -3288,8 +3288,8 @@ functions:code: |```pythonresponse = (- supabase.table("countries")- .insert({"id": 1, "name": "Denmark"})+ supabase.table("planets")+ .insert({"id": 1, "name": "Pluto"}).execute())```@@ -3297,7 +3297,7 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);```response: |```json@@ -3305,7 +3305,7 @@ functions:"data": [{"id": 1,- "name": "Denmark"+ "name": "Pluto"}],"count": null@@ -3318,10 +3318,10 @@ functions:code: |```pythontry:- response = supabase.table("countries")+ response = supabase.table("characters").insert([- { "id": 1, "name": "Nepal" },- { "id": 1, "name": "Vietnam" },+ { "id": 1, "name": "Frodo" },+ { "id": 1, "name": "Sam" },]).execute()return response@@ -3332,7 +3332,7 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);```response: |```json@@ -3341,9 +3341,9 @@ functions:"code": "23505","details": "Key (id)=(1) already exists.","hint": null,- "message": "duplicate key value violates unique constraint \"countries_pkey\""+ "message": "duplicate key value violates unique constraint \"characters_pkey\""},- "message": "duplicate key value violates unique constraint \"countries_pkey\"",+ "message": "duplicate key value violates unique constraint \"characters_pkey\"","code": "23505","hint": null,"details": "Key (id)=(1) already exists."@@ -3372,8 +3372,8 @@ functions:code: |```pythonresponse = (- supabase.table("countries")- .update({"name": "Australia"})+ supabase.table("instruments")+ .update({"name": "piano"}).eq("id", 1).execute())@@ -3382,12 +3382,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Denmark');+ (1, 'harpsichord');```response: |```json@@ -3395,7 +3395,7 @@ functions:"data": [{"id": 1,- "name": "Australia"+ "name": "piano"}],"count": null@@ -3483,8 +3483,8 @@ functions:code: |```pythonresponse = (- supabase.table("countries")- .upsert({"id": 1, "name": "Australia"})+ supabase.table("instruments")+ .upsert({"id": 1, "name": "piano"}).execute())```@@ -3492,12 +3492,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json@@ -3505,7 +3505,7 @@ functions:"data": [{"id": 1,- "name": "Australia"+ "name": "piano"}],"count": null@@ -3518,8 +3518,8 @@ functions:code: |```pythonresponse = (- supabase.table("countries")- .upsert([{"id": 1, "name": "Albania"}, {"id": 2, "name": "Algeria"}])+ supabase.table("instruments")+ .upsert([{"id": 1, "name": "piano"}, {"id": 2, "name": "guitar"}]).execute())```@@ -3527,12 +3527,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json@@ -3540,11 +3540,11 @@ functions:"data": [{"id": 1,- "name": "Albania"+ "name": "piano"},{"id": 2,- "name": "Algeria"+ "name": "guitar"}],"count": null@@ -3634,7 +3634,7 @@ functions:insert intocountries (id, name)values- (1, 'Spain');+ (1, 'Mordor');```response: |```@@ -3642,7 +3642,7 @@ functions:"data": [{"id": 1,- "name": "Spain"+ "name": "Mordor"}],"count": null@@ -3660,12 +3660,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ characters (id int8 primary key, name text);insert into- countries (id, name)+ characters (id, name)values- (1, 'Spain'), (2, 'France'), (3, 'Germany');+ (1, 'Harry'), (2, 'Hermione'), (3, 'Ron');```response: |```json@@ -3673,15 +3673,15 @@ functions:"data": [{"id": 1,- "name": "Spain"+ "name": "Harry"},{"id": 2,- "name": "France"+ "name": "Hermione"},{"id": 3,- "name": "Germany"+ "name": "Ron"}],"count": null@@ -3798,22 +3798,22 @@ functions:name: Call a Postgres function with filterscode: |```python- response = supabase.rpc("list_stored_countries").eq("id", 1).single().execute()+ response = supabase.rpc("list_stored_planets").eq("id", 1).single().execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'France'),- (2, 'United Kingdom');+ (1, 'Earth'),+ (2, 'Mars');- create function list_stored_countries() returns setof countries as $$- select * from countries;+ create function list_stored_planets() returns setof planets as $$+ select * from planets;$$ language sql;```response: |@@ -3821,7 +3821,7 @@ functions:{"data": {"id": 1,- "name": "France"+ "name": "Earth"},"count": null}@@ -3870,17 +3870,17 @@ functions:```python# Correctresponse = (- supabase.table("cities")- .select("name, country_id")- .eq("name", "Bali")+ supabase.table("instruments")+ .select("name, section_id")+ .eq("name", "flute").execute())# Incorrectresponse = (- supabase.table("cities")- .eq("name", "Bali")- .select("name, country_id")+ supabase.table("instruments")+ .eq("name", "flute")+ .select("name, section_id").execute())```@@ -3888,37 +3888,37 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```- id: chaining-filtersname: Chainingdescription: |Filters can be chained together to produce advanced queries. For example,- to query cities with population between 1,000 and 10,000.+ to query instruments with octave ranges between 3 and 7 (non-inclusive).code: |```pythonresponse = (- supabase.table("cities")- .select("name, country_id")- .gte("population", 1000)- .lt("population", 10000)+ supabase.table("instruments")+ .select("name, section_id")+ .gte("octave_range", 3)+ .lt("octave_range", 7).execute())```@@ -3926,33 +3926,33 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ secttion_id int8 not null references orchestral_sections,name text,- population int8+ octave_range int8);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'percussion'),+ (2, 'strings');insert into- cities (id, country_id, name, population)+ instruments (id, section_id, name, octave_range)values- (1, 2, 'Bali', 9980),- (2, 1, 'Munich', 250000);+ (1, 2, 'violin', 4),+ (2, 1, 'piano', 7);```response: |```json{"data": [{- "name": "Bali",- "country_id": 2+ "name": "violin",+ "section_id": 2}],"count": null@@ -3965,19 +3965,19 @@ functions:code: |```pythonfilterByName = None- filterPopLow = 1000- filterPopHigh = 10000+ filterOctaveLow = 3+ filterOctaveHigh = 7- query = supabase.table("cities").select("name, country_id")+ query = supabase.table("instruments").select("name, section_id")if filterByName:query = query.eq("name", filterByName)- if filterPopLow:- query = query.gte("population", filterPopLow)+ if filterAgeLow:+ query = query.gte("octave_range", filterOctaveLow)- if filterPopHigh:- query = query.lt("population", filterPopHigh)+ if filterAgeHigh:+ query = query.lt("octave_range", filterOctaveHigh)response = query.execute()```@@ -3985,33 +3985,33 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text,- population int8+ octave_range int8);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'percussion'),+ (2, 'strings');insert into- cities (id, country_id, name, population)+ instruments (id, section_id, name, octave_range)values- (1, 2, 'Bali', 9980),- (2, 1, 'Munich', 250000);+ (1, 2, 'violin', 4),+ (2, 1, 'piano', 7);```response: |```json{"data": [{- "name": "Bali",- "country_id": 2+ "name": "violin",+ "section_id": 2}],"count": null@@ -4064,9 +4064,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")- .select("name, cities!inner(name)")- .eq("cities.name", "Bali")+ supabase.table("orchestral_sections")+ .select("name, instruments!inner(name)")+ .eq("instruments.name", "flute").execute())```@@ -4074,34 +4074,34 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "instruments": [{- "name": "Bali"+ "name": "flute"}]}@@ -4131,20 +4131,20 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("*").eq("name", "Albania").execute()+ response = supabase.table("planets").select("*").eq("name", "Earth").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -4152,7 +4152,7 @@ functions:"data": [{"id": 2,- "name": "Albania"+ "name": "Earth"}],"count": null@@ -4178,20 +4178,20 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("*").neq("name", "Albania").execute()+ response = supabase.table("planets").select("*").neq("name", "Earth").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -4199,11 +4199,11 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "Mercury"},{"id": 3,- "name": "Algeria"+ "name": "Mars"}],"count": null@@ -4229,20 +4229,20 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("*").gt("id", 2).execute()+ response = supabase.table("planets").select("*").gt("id", 2).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -4250,7 +4250,7 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Mars"}],"count": null@@ -4279,20 +4279,20 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("*").gte("id", 2).execute()+ response = supabase.table("planets").select("*").gte("id", 2).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -4300,11 +4300,11 @@ functions:"data": [{"id": 2,- "name": "Albania"+ "name": "Earth"},{"id": 3,- "name": "Algeria"+ "name": "Mars"}],"count": null@@ -4330,20 +4330,20 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("*").lt("id", 2).execute()+ response = supabase.table("planets").select("*").lt("id", 2).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -4351,7 +4351,7 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "Mercury"}],"count": null@@ -4377,20 +4377,20 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("*").lte("id", 2).execute()+ response = supabase.table("planets").select("*").lte("id", 2).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -4398,11 +4398,11 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "Mercury"},{"id": 2,- "name": "Albania"+ "name": "Earth"}],"count": null@@ -4428,20 +4428,20 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("*").like("name", "%Alba%").execute()+ response = supabase.table("planets").select("*").like("name", "%Ea%").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -4449,7 +4449,7 @@ functions:"data": [{"id": 2,- "name": "Albania"+ "name": "Earth"}],"count": null@@ -4475,20 +4475,20 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("*").ilike("name", "%alba%").execute()+ response = supabase.table("planets").select("*").ilike("name", "%ea%").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -4496,7 +4496,7 @@ functions:"data": [{"id": 2,- "name": "Albania"+ "name": "Earth"}],"count": null@@ -4522,18 +4522,18 @@ functions:name: Checking for nullness, True or Falsecode: |```python- response = supabase.table("countries").select("*").is_("name", "null").execute()+ response = supabase.table("planets").select("*").is_("name", "null").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Germany'),+ (1, 'Earth'),(2, null);```response: |@@ -4575,9 +4575,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")+ supabase.table("planets").select("*")- .in_("name", ["Albania", "Algeria"])+ .in_("name", ["Earth", "Mars"]).execute())```@@ -4585,14 +4585,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -4600,11 +4600,11 @@ functions:"data": [{"id": 2,- "name": "Albania"+ "name": "Earth"},{"id": 3,- "name": "Algeria"+ "name": "Mars"}],"count": null@@ -5010,7 +5010,7 @@ functions:}],"count": null- }+ }```description: |Postgres supports a number of [range types](https://www.postgresql.org/docs/current/rangetypes.html). You can filter on range columns using the string representation of range values.@@ -5432,9 +5432,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")+ supabase.table("planets").select("*")- .match({"id": 2, "name": "Albania"})+ .match({"id": 2, "name": "Earth"}).execute())```@@ -5442,14 +5442,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -5457,7 +5457,7 @@ functions:"data": [{"id": 2,- "name": "Albania"+ "name": "Earth"}],"count": null@@ -5480,7 +5480,7 @@ functions:code: |```pythonresponse = (- supabase.table("countries")+ supabase.table("planets").select("*").not_.is_("name", "null").execute()@@ -5490,12 +5490,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Albania'),+ (1, 'Mercury'),(2, null);```response: |@@ -5504,7 +5504,7 @@ functions:"data": [{"id": 1,- "name": "Albania"+ "name": "Mercury"}],"count": null@@ -5536,9 +5536,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")+ supabase.table("planets").select("name")- .or_("id.eq.2,name.eq.Algeria")+ .or_("id.eq.2,name.eq.Mars").execute())```@@ -5546,24 +5546,24 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json{"data": [{- "name": "Albania"+ "name": "Earth"},{- "name": "Algeria"+ "name": "Mars"}],"count": null@@ -5576,9 +5576,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")+ supabase.table("planets").select("name")- .or_("id.gt.3,and(id.eq.1,name.eq.Afghanistan)")+ .or_("id.gt.3,and(id.eq.1,name.eq.Mercury)").execute())```@@ -5586,21 +5586,21 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```reponse: |```json{"data": [{- "name": "Afghanistan"+ "name": "Mercury"}],"count": null@@ -5612,9 +5612,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")- .select("name, cities!inner(name)")- .or_("country_id.eq.1,name.eq.Beijing", reference_table="cities")+ supabase.table("orchestral_sections")+ .select("name, instruments!inner(name)")+ .or_("book_id.eq.1,name.eq.guqin", reference_table="instruments").execute())```@@ -5622,34 +5622,34 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Germany",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Munich"+ "name": "violin"}]}@@ -5687,9 +5687,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")+ supabase.table("planets").select("*")- .filter("name", "in", '("Algeria","Japan")')+ .filter("name", "in", '("Mars","Tatooine")').execute())```@@ -5697,14 +5697,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -5712,7 +5712,7 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "Mars"}],"count": null@@ -5725,9 +5725,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")- .select("name, cities!inner(name)")- .filter("cities.name", "eq", "Bali")+ supabase.table("orchestral_sections")+ .select("name, instruments!inner(name)")+ .filter("instruments.name", "eq", "flute").execute())```@@ -5735,34 +5735,34 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "instruments": [{- "name": "Bali"+ "name": "flute"}]}@@ -5809,7 +5809,7 @@ functions:code: |```pythonresponse = (- supabase.table("countries")+ supabase.table("planets").select("*").order("name", desc=True).execute()@@ -5819,14 +5819,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json@@ -5834,15 +5834,15 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "Mercury"},{- "id": 2,- "name": "Albania"+ "id": 3,+ "name": "Mars"},{- "id": 3,- "name": "Algeria"+ "id": 2,+ "name": "Earth"}],"count": null@@ -5855,51 +5855,51 @@ functions:code: |```pythonresponse = (- supabase.table("countries")- .select("name, cities(name)")- .order("name", desc=True, foreign_table="cities")+ supabase.table("orchestral_sections")+ .select("name, instruments(name)")+ .order("name", desc=True, foreign_table="instruments").execute())```data:sql: |create table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States'),- (2, 'Vanuatu');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');response: |```json{"data": [{- "name": "United States",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "New York City"+ "name": "violin"},{- "name": "Atlanta"+ "name": "harp"}]},{- "name": "Vanuatu",- "cities": []+ "name": "woodwinds",+ "instruments": []}],"count": null@@ -5914,45 +5914,45 @@ functions:code: |```pythonresponse = (- supabase.table("cities")- .select("name, country:countries(name)")- .order("country(name)", desc=False)+ supabase.table("instruments")+ .select("name, section:orchestral_sections(name)")+ .order("section(name)", desc=False))```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Munich'),- (2, 2, 'Bali');+ (1, 1, 'violin'),+ (2, 2, 'flute');```response: |```json{"data": [{- "name": "Munich",- "country": { "name": "Germany" }+ "name": "violin",+ "section": { "name": "strings" }},{- "name": "Bali",- "country": { "name": "Indonesia" }+ "name": "flute",+ "section": { "name": "woodwinds" }}],"status": 200,@@ -5979,27 +5979,27 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("name").limit(1).execute()+ response = supabase.table("planets").select("name").limit(1).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Mercury"}],"count": null@@ -6012,9 +6012,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")- .select("name, cities(name)")- .limit(1, foreign_table="cities")+ supabase.table("orchestral_sections")+ .select("name, instruments(name)")+ .limit(1, foreign_table="instruments").execute())```@@ -6022,33 +6022,33 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States');+ (1, 'strings');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "United States",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Atlanta"+ "name": "harp"}]}@@ -6081,30 +6081,30 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("name").range(0, 1).execute()+ response = supabase.table("planets").select("name").range(0, 1).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "Mercury"},{- "name": "Albania"+ "name": "Earth"}],"count": null@@ -6117,9 +6117,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")- .select("name, cities(name)")- .range(0, 1, foreign_table="cities")+ supabase.table("orchestral_sections")+ .select("name, instruments(name)")+ .range(0, 1, foreign_table="instruments").execute())```@@ -6127,53 +6127,53 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'brass'),+ (2, 'strings'),+ (3, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Kabul'),- (2, 1, 'Herat'),- (3, 2, 'Berat');+ (1, 1, 'horn'),+ (2, 1, 'tuba'),+ (3, 2, 'violin');```response: |```json{"data": [{- "name": "Afghanistan",- "cities": [+ "name": "brass",+ "instruments": [{- "name": "Kabul"+ "name": "horn"},{- "name": "Herat"+ "name": "tuba"}]},{- "name": "Albania",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Berat"+ "name": "violin"}]},{- "name": "Algeria",- "cities": []+ "name": "woodwinds",+ "instruments": []}],"count": null@@ -6188,26 +6188,26 @@ functions:name: With `select()`code: |```python- response = supabase.table("countries").select("name").limit(1).single().execute()+ response = supabase.table("planets").select("name").limit(1).single().execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json{"data": {- "name": "Afghanistan"+ "name": "Mercury"},"count": null}@@ -6223,9 +6223,9 @@ functions:code: |```pythonresponse = (- supabase.table("countries")+ supabase.table("planets").select("*")- .eq("name", "Albania")+ .eq("name", "Earth").maybe_single().execute())@@ -6234,21 +6234,21 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json{"data": {"id": 2,- "name": "Albania"+ "name": "Earth"},"count": null}@@ -6264,25 +6264,25 @@ functions:name: Return data as CSVcode: |```python- response = supabase.table("countries").select("*").csv().execute()+ response = supabase.table("planets").select("*").csv().execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```json{- "data": "id,name\n1,Afghanistan\n2,Albania\n3,Algeria",+ "data": "id,name\n1,Mercury\n2,Earth\n3,Mars","count": null}```@@ -6335,26 +6335,26 @@ functions:name: Get the execution plancode: |```python- response = supabase.table("countries").select("*").explain().execute()+ response = supabase.table("planets").select("*").explain().execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```Aggregate (cost=33.34..33.36 rows=1 width=112)-> Limit (cost=0.00..18.33 rows=1000 width=40)- -> Seq Scan on countries (cost=0.00..22.00 rows=1200 width=40)+ -> Seq Scan on planets (cost=0.00..22.00 rows=1200 width=40)```description: |By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.@@ -6366,7 +6366,7 @@ functions:code: |```pythonresponse = (- supabase.table("countries")+ supabase.table("planets").select("*").explain(analyze=True, verbose=True).execute()@@ -6376,23 +6376,23 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ planets (id int8 primary key, name text);insert into- countries (id, name)+ planets (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'Mercury'),+ (2, 'Earth'),+ (3, 'Mars');```response: |```Aggregate (cost=33.34..33.36 rows=1 width=112) (actual time=0.041..0.041 rows=1 loops=1)- Output: NULL::bigint, count(ROW(countries.id, countries.name)), COALESCE(json_agg(ROW(countries.id, countries.name)), '[]'::json), NULLIF(current_setting('response.headers'::text, true), ''::text), NULLIF(current_setting('response.status'::text, true), ''::text)+ Output: NULL::bigint, count(ROW(planets.id, planets.name)), COALESCE(json_agg(ROW(planets.id, planets.name)), '[]'::json), NULLIF(current_setting('response.headers'::text, true), ''::text), NULLIF(current_setting('response.status'::text, true), ''::text)-> Limit (cost=0.00..18.33 rows=1000 width=40) (actual time=0.005..0.006 rows=3 loops=1)- Output: countries.id, countries.name- -> Seq Scan on public.countries (cost=0.00..22.00 rows=1200 width=40) (actual time=0.004..0.005 rows=3 loops=1)- Output: countries.id, countries.name+ Output: planets.id, planets.name+ -> Seq Scan on public.planets (cost=0.00..22.00 rows=1200 width=40) (actual time=0.004..0.005 rows=3 loops=1)+ Output: planets.id, planets.nameQuery Identifier: -4730654291623321173Planning Time: 0.407 msExecution Time: 0.119 ms@@ -6449,14 +6449,14 @@ functions:- id: passing-custom-headersname: Passing custom headersdescription: |- The library accepts custom headers via the `headers` option.+ The library accepts custom headers via the `headers` option.Note: `supabase-py` automatically populates the `Authorization` header if there is a signed in user.isSpotlight: truecode: |```pythonresponse = supabase.functions.invoke(- "hello-world",+ "hello-world",invoke_options={"headers": {"my-custom-header": "my-custom-header-value"@@ -6787,7 +6787,7 @@ functions:name: Create bucketcode: |```python- response = supabase.storage.create_bucket('avatars',+ response = supabase.storage.create_bucket('avatars',options={"public": False,"allowed_mime_types": ["image/png"],@@ -6864,7 +6864,7 @@ functions:name: Update bucketcode: |```python- response = supabase.storage.update_bucket('avatars',+ response = supabase.storage.update_bucket('avatars',options={"public": False,"allowed_mime_types": ["image/png"],diff --git a/apps/docs/spec/supabase_swift_v1.yml b/apps/docs/spec/supabase_swift_v1.ymlindex 29a2536d439..e88c32c51ec 100644--- a/apps/docs/spec/supabase_swift_v1.yml+++ b/apps/docs/spec/supabase_swift_v1.yml@@ -32,7 +32,7 @@ functions:code: |```swiftlet client = SupabaseClient(- supabaseURL: URL(string: "https://xyzcompany.supabase.co")!,+ supabaseURL: URL(string: "https://xyzcompany.supabase.co")!,supabaseKey: "public-anon-key",options: SupabaseClientOptions(db: .init(@@ -68,7 +68,7 @@ functions:code: |```swiftlet supabase = SupabaseClient(- supabaseURL: URL(string: "https://xyzcompany.supabase.co")!,+ supabaseURL: URL(string: "https://xyzcompany.supabase.co")!,supabaseKey: "public-anon-key",options: .init(auth: .init(@@ -210,7 +210,7 @@ functions:```swiftlet url = try await supabase.auth.getOAuthSignInURL(provider: .github)- let session = ASWebAuthenticationSession(url: url, callbackURLScheme: "my-app-scheme") { url, error in+ let session = ASWebAuthenticationSession(url: url, callbackURLScheme: "my-app-scheme") { url, error inguard let url else { return }Task {@@ -591,13 +591,13 @@ functions:isSpotlight: truecode: |```swift- struct Country: Decodable {+ struct Instrument: Decodable {let id: Intlet name: String}- let countries: [Country] = try await supabase.database- .from("countries")+ let instruments: [Instrument] = try await supabase.database+ .from("instruments").select().execute().value@@ -606,14 +606,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json@@ -621,15 +621,15 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "violin"},{"id": 2,- "name": "Albania"+ "name": "viola"},{"id": 3,- "name": "Algeria"+ "name": "cello"}],"status": 200,@@ -640,12 +640,12 @@ functions:name: Selecting specific columnscode: |```swift- struct Country: Decodable {+ struct Instrument: Decodable {let name: String}- let countries: [Country] = try await supabase.database- .from("countries")+ let instruments: [Instrument] = try await supabase.database+ .from("instruments").select("name").execute().value@@ -654,27 +654,27 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "violin"},{- "name": "Albania"+ "name": "viola"},{- "name": "Algeria"+ "name": "cello"}],"status": 200,@@ -687,21 +687,21 @@ functions:If your database has foreign key relationships, you can query related tables too.code: |```swift- struct Country: Decodable {+ struct OrchestralSection: Decodable {let name: String- let cities: [City]+ let instruments: [Instrument]}- struct City: Decodable {+ struct Instrument: Decodable {let name: String}- let countries: [Country] = try await supabase.database- .from("countries")+ let orchestralSections: [OrchestralSection] = try await supabase.database+ .from("orchestral_sections").select("""name,- cities (+ instruments (name)"""@@ -713,42 +713,42 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, seciton_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'violin'),+ (2, 1, 'flute');```response: |```json{"data": [{- "name": "Germany",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Munich"+ "name": "violin"}]},{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "instruments": [{- "name": "Bali"+ "name": "flute"}]}@@ -765,7 +765,7 @@ functions:let name: Stringlet teams: [Team]}-+struct Team: Decodable {let name: String}@@ -933,19 +933,19 @@ functions:name: Filtering through foreign tablescode: |```swift- struct City: Decodable {+ struct Instrument: Decodable {let name: String- let countries: [Country]?+ let orchestral_sections: [OrchestralSection]?}- struct Country: Decodable {+ struct OrchestralSection: Decodable {let name: String}- let cities: [City] = try await supabase.database- .from("cities")- .select("name, countries(*)")- .eq("countries.name", value: "Estonia")+ let instruments: [Instrument] = try await supabase.database+ .from("instruments")+ .select("name, orchestral_sections(*)")+ .eq("orchestral_sections.name", value: "percussion").execute().value```@@ -953,36 +953,36 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, book_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Bali",- "countries": null+ "name": "flute",+ "orchestral_sections": null},{- "name": "Munich",- "countries": null+ "name": "violin",+ "orchestral_sections": null}],"status": 200,@@ -998,52 +998,52 @@ functions:name: Querying foreign table with countcode: |```swift- struct Country: Decodable {+ struct OrchestralSection: Decodable {let id: UUIDlet name: String- let cities: [City]+ let instruments: [Instrument]}- struct City: Decodable {+ struct Instrument: Decodable {let count: Int}- let countries: [Country] = try await supabase.database- .from("countries")- .select("*, cities(count)")+ let orchestralSections: [OrchestralSection] = try await supabase.database+ .from("orchestral_sections")+ .select("*, instruments(count)").execute().value```data:sql: |```sql- create table countries (+ create table orchestral_sections ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text);- create table cities (+ create table instruments ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text,- "country_id" "uuid" references public.countries on delete cascade+ "section_id" "uuid" references public.orchestral_sections on delete cascade);- with country as (- insert into countries (name)- values ('united kingdom') returning id+ with section as (+ insert into orchestral_sections (name)+ values ('strings') returning id)- insert into cities (name, country_id) values- ('London', (select id from country)),- ('Manchester', (select id from country)),- ('Liverpool', (select id from country)),- ('Bristol', (select id from country));+ insert into instruments (name, section_id) values+ ('violin', (select id from section)),+ ('viola', (select id from section)),+ ('cello', (select id from section)),+ ('double bass', (select id from section));```response: |```json[{"id": "693694e7-d993-4360-a6d7-6294e325d9b6",- "name": "United Kingdom",+ "name": "strings","cities": [{"count": 4@@ -1061,7 +1061,7 @@ functions:code: |```swiftlet count = try await supabase.database- .from("countries")+ .from("instruments").select("*", head: true, count: .exact).execute().count@@ -1070,14 +1070,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json@@ -1125,7 +1125,7 @@ functions:insert intousers (id, name, address)values- (1, 'Avdotya', '{"city":"Saint Petersburg"}');+ (1, 'Frodo', '{"city":"Hobbiton"}');```response: |```json@@ -1133,8 +1133,8 @@ functions:"data": [{"id": 1,- "name": "Avdotya",- "city": "Saint Petersburg"+ "name": "Frodo",+ "city": "Hobbiton"}],"status": 200,@@ -1151,53 +1151,65 @@ functions:name: Querying foreign table with inner joincode: |```swift- struct City: Decodable {+ struct Instrument: Decodable {let name: String- let countries: [Country]+ let sections: [Section]}- struct Country: Decodable {+ struct Section: Decodable {let name: String}- let cities: [City] = try await supabase.database- .from("cities")- .select("name, countries!inner(name)")- .eq("countries.name", value: "Indonesia")+ let instruments: [Instrument] = try await supabase.database+ .from("instruments")+ .select("name, sections!inner(name)")+ .eq("sections.name", value: "strings").execute().value```data:sql: |```sql- create table countries (+ create table sections ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text);- create table cities (+ create table instruments ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text,- "country_id" "uuid" references public.countries on delete cascade+ "section_id" "uuid" references public.sections on delete cascade);- with country as (- insert into countries (name)- values ('united kingdom') returning id+ with section as (+ insert into sections (name)+ values ('strings') returning id)- insert into cities (name, country_id) values- ('London', (select id from country)),- ('Manchester', (select id from country)),- ('Liverpool', (select id from country)),- ('Bristol', (select id from country));+ insert into instruments (name, section_id) values+ ('violin', (select id from section)),+ ('viola', (select id from section)),+ ('cello', (select id from section)),+ ('double bass', (select id from section));```response: |```json{"data": [{- "name": "Bali",- "countries": {"name": "Indonesia"}+ "name": "violin",+ "sections": {"name": "strings"}+ },+ {+ "name": "viola",+ "sections": {"name": "strings"}+ },+ {+ "name": "cello",+ "sections": {"name": "strings"}+ },+ {+ "name": "double bass",+ "sections": {"name": "strings"}}],"status": 200,@@ -1206,7 +1218,7 @@ functions:```description: |If you don't want to return the foreign table contents, you can leave the parenthesis empty.- Like `.select('name, countries!inner()')`.+ Like `.select('name, sections!inner()')`.hideCodeBlock: true- id: insert@@ -1216,23 +1228,23 @@ functions:name: Create a recordcode: |```swift- struct Country: Encodable {+ struct Instrument: Encodable {let id: Intlet name: String}- let country = Country(id: 1, name: "Denmark")+ let instrument = Instrument(id: 1, name: "piano")try await supabase.database- .from("countries")- .insert(country)+ .from("instruments")+ .insert(instrument).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);```response: |```json@@ -1247,17 +1259,17 @@ functions:name: Create a record and return itcode: |```swift- struct Country: Codable {+ struct Instrument: Codable {let id: Intlet name: String}let country: Country = try await supabase.database- .from("countries")+ .from("instruments")// use `returning: .representation` to return the created object.- .insert(Country(id: 1, name: "Denmark"), returning: .representation)+ .insert(Instrument(id: 1, name: "piano"), returning: .representation)// specify you want a single value returned, otherwise it returns a list.- .single()+ .single().execute().value```@@ -1265,7 +1277,7 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);```response: |```json@@ -1273,7 +1285,7 @@ functions:"data": [{"id": 1,- "name": "Denmark"+ "name": "piano"}],"status": 201,@@ -1285,26 +1297,26 @@ functions:name: Bulk createcode: |```swift- struct Country: Encodable {+ struct Instrument: Encodable {let id: Intlet name: String}- let countries = [- Country(id: 1, name: "Nepal"),- Country(id: 1, name: "Vietnam"),+ let instruments = [+ Instrument(id: 1, name: "piano"),+ Instrument(id: 1, name: "guitar"),]try await supabase.database- .from("countries")- .insert(countries)+ .from("instruments")+ .insert(instruments).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);```response: |```json@@ -1313,7 +1325,7 @@ functions:"code": "23505","details": "Key (id)=(1) already exists.","hint": null,- "message": "duplicate key value violates unique constraint \"countries_pkey\""+ "message": "duplicate key value violates unique constraint \"instruments_pkey\""},"status": 409,"statusText": "Conflict"@@ -1334,8 +1346,8 @@ functions:code: |```swifttry await supabase.database- .from("countries")- .update(["name": "Australia"])+ .from("instruments")+ .update(["name": "piano"]).eq("id", value: 1).execute()```@@ -1347,12 +1359,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Taiwan');+ (1, 'harpsichord');```response: |```json@@ -1367,14 +1379,14 @@ functions:name: Update a record and return itcode: |```swift- struct Country: Decodable {+ struct Instrument: Decodable {let id: Int- let name: String+ let name: String}- let country: Country = try await supabase.database- .from("countries")- .update(["name": "Australia"], returning: .representation)+ let instrument: Instrument = try await supabase.database+ .from("instruments")+ .update(["name": "piano"], returning: .representation).eq("id", value: 1)// If you know this query should return a single object, append a `single()` modifier to it..single()@@ -1385,12 +1397,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Taiwan');+ (1, 'harpsichord');```response: |```json@@ -1398,7 +1410,7 @@ functions:"data": [{"id": 1,- "name": "Australia"+ "name": "piano"}],"status": 200,@@ -1487,25 +1499,25 @@ functions:name: Upsert your datacode: |```swift- struct Country: Encodable {+ struct Instrument: Encodable {let id: Intlet name: String}try await supabase.database- .from("countries")- .upsert(Country(id: 1, name: "Albania"))+ .from("instruments")+ .upsert(Instrument(id: 1, name: "piano")).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json@@ -1513,7 +1525,7 @@ functions:"data": [{"id": 1,- "name": "Albania"+ "name": "piano"}],"status": 201,@@ -1526,15 +1538,15 @@ functions:name: Bulk Upsert your datacode: |```swift- struct Country: Encodable {+ struct Instrument: Encodable {let id: Intlet name: String}try await supabase.database- .from("countries")+ .from("instruments").upsert([- Country(id: 1, name: "Albania"),- Country(id: 2, name: "Algeria"),+ Instrument(id: 1, name: "piano"),+ Instrument(id: 2, name: "guitar"),]).execute()```@@ -1542,12 +1554,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json@@ -1555,11 +1567,11 @@ functions:"data": [{"id": 1,- "name": "Albania"+ "name": "piano"},{"id": 2,- "name": "Algeria"+ "name": "guitar"}],"status": 201,@@ -1644,7 +1656,7 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("instruments").delete().eq("id", value: 1).execute()@@ -1653,12 +1665,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Spain');+ (1, 'tuba');```response: |```json@@ -1769,13 +1781,13 @@ functions:name: Call a Postgres function with filterscode: |```swift- struct Country: Decodable {+ struct Instrument: Decodable {let id: Intlet name: String}- let country: Country = await supabase.database- .rpc("list_stored_countries")+ let instrument: Instrument = await supabase.database+ .rpc("list_stored_instruments").eq("id", value: 1).single().execute()@@ -1785,16 +1797,16 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'France'),- (2, 'United Kingdom');+ (1, 'piano'),+ (2, 'guitar');- create function list_stored_countries() returns setof countries as $$- select * from countries;+ create function list_stored_instruments() returns setof instruments as $$+ select * from instruments;$$ language sql;```response: |@@ -1802,7 +1814,7 @@ functions:{"data": {"id": 1,- "name": "France"+ "name": "piano"},"status": 200,"statusText": "OK"@@ -1841,7 +1853,7 @@ functions:.eq("name", value: "The Shire") // Correcttry await supabase.database- .from("citites")+ .from("cities").eq("name", value: "The Shire") // Incorrect.select("name, country_id")```@@ -1933,49 +1945,49 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("sections").select("""name,- cities!inner (+ instruments!inner (name)""")- .eq("cities.name", value: "Bali")+ .eq("instruments.name", value: "violin")```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references sections,name text);insert into- countries (id, name)+ sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, country_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "Bali"+ "name": "violin"}]}@@ -2002,32 +2014,32 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("instruments").select("name")- .or("id.eq.2,name.eq.Algeria")+ .or("id.eq.2,name.eq.cello")```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{"data": [{- "name": "Albania"+ "name": "viola"},{- "name": "Algeria"+ "name": "cello"}],"status": 200,@@ -2041,29 +2053,29 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("instruments").select("name")- .or("id.gt.3,and(id.eq.1,name.eq.Afghanistan)")+ .or("id.gt.3,and(id.eq.1,name.eq.violin)")```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```reponse: |```json{"data": [{- "name": "Afghanistan"+ "name": "violin"}],"status": 200,@@ -2080,7 +2092,7 @@ functions:- `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values.```swift- .not("name", operator: .eq, value: "Paris")+ .not("name", operator: .eq, value: "violin").not("arraycol", operator: .cs, value: #"{"a","b"}"#) // Use Postgres array {} for array column and 'cs' for contains..not("rangecol", operator: .cs, value: "(1,2]") // Use Postgres range syntax for range column..not("id", operator: .in, value: "(6,7)") // Use Postgres list () and 'in' for in_ filter.@@ -2093,7 +2105,7 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("instruments").select().not("name", operator: .is, value: "").execute()@@ -2107,29 +2119,29 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("instruments").select("name")- .match(["id": 2, "name": "Albania"])+ .match(["id": 2, "name": "viola"])```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{"data": [{- "name": "Albania"+ "name": "viola"}],"status": 200,@@ -2154,22 +2166,22 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("instruments").select()- .filter("name", operator: .in, value: #"("Algeria","Japan")"#)+ .filter("name", operator: .in, value: #"("cello","guzheng")"#)```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json@@ -2177,7 +2189,7 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "cello"}],"status": 200,@@ -2191,49 +2203,49 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("sections").select("""name,- cities!inner (+ instruments!inner (name)""")- .filter("cities.name", operator: .eq, value: "Bali")+ .filter("instruments.name", operator: .eq, value: "flute")```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references sections,name text);insert into- countries (id, name)+ sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",+ "name": "woodwinds","cities": [{- "name": "Bali"+ "name": "flute"}]}@@ -2265,8 +2277,8 @@ functions:code: |```swifttry await database.database- .from("countries")- .upsert(CountryModel(id: 1, name: "Algeria"))+ .from("instruments")+ .upsert(InstrumentModel(id: 1, name: "piano")).select().execute()```@@ -2274,12 +2286,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json@@ -2287,7 +2299,7 @@ functions:"data": [{"id": 1,- "name": "Algeria"+ "name": "piano"}],"status": 201,@@ -2306,7 +2318,7 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("instruments").select("id, name").order("id", ascending: false).execute()@@ -2315,14 +2327,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```swifton@@ -2330,15 +2342,15 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "cello"},{"id": 2,- "name": "Albania"+ "name": "viola"},{"id": 1,- "name": "Afghanistan"+ "name": "violin"}],"status": 200,@@ -2352,58 +2364,58 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("sections").select("""name,- cities (+ instruments (name)""")- .order("name", ascending: false, foreignTable: "cities")+ .order("name", ascending: false, foreignTable: "instruments").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references sections,name text);insert into- countries (id, name)+ sections (id, name)values- (1, 'United States'),- (2, 'Vanuatu');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'double bass'),+ (2, 1, 'violin');```response: |```swifton{"data": [{- "name": "United States",+ "name": "strings","cities": [{- "name": "New York City"+ "name": "violin"},{- "name": "Atlanta"+ "name": "double bass"}]},{- "name": "Vanuatu",+ "name": "woodwinds","cities": []}],@@ -2426,7 +2438,7 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("instruments").select("id, name").limit(1).execute()@@ -2435,21 +2447,21 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "violin"}],"status": 200,@@ -2463,49 +2475,49 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("orchestral_sections").select("""name,- cities (+ instruments (name)""")- .limit(1, foreignTable: "cities")+ .limit(1, foreignTable: "instruments").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States');+ (1, 'strings');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "United States",+ "name": "strings","cities": [{- "name": "Atlanta"+ "name": "harp"}]}@@ -2525,11 +2537,11 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("orchestral_sections").select("""name,- cities (+ instruments (name)"""@@ -2541,24 +2553,24 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```swifton{"data": [{- "name": "Afghanistan"+ "name": "violin"},{- "name": "Albania"+ "name": "viola"}],"status": 200,@@ -2578,7 +2590,7 @@ functions:code: |```swifttry await supabase.database- .from("countries")+ .from("instruments").select("name").limit(1).single()@@ -2588,20 +2600,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{"data": {- "name": "Afghanistan"+ "name": "violin"},"status": 200,"statusText": "OK"@@ -2617,7 +2629,7 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select().csv().execute()@@ -2626,19 +2638,19 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{- "data": "id,name\n1,Afghanistan\n2,Albania\n3,Algeria",+ "data": "id,name\n1,violin\n2,viola\n3,cello","status": 200,"statusText": "OK"}@@ -2666,7 +2678,7 @@ functions:let response: Response = try await supabase.functions.invoke(- "hello",+ "hello",options: FunctionInvokeOptions(body: ["foo": "bar"])@@ -2679,11 +2691,11 @@ functions:```swiftlet response = try await supabase.functions.invoke(- "hello",+ "hello",options: FunctionInvokeOptions(body: ["foo": "bar"]),- decode: { data, response in+ decode: { data, response inString(data: data, encoding: .utf8)})@@ -2703,7 +2715,7 @@ functions:do {let response = try await supabase.functions.invoke(- "hello",+ "hello",options: FunctionInvokeOptions(body: ["foo": "bar"])@@ -2725,7 +2737,7 @@ functions:```swiftlet response = try await supabase.functions.invoke(- "hello",+ "hello",options: FunctionInvokeOptions(headers: ["my-custom-header": "my-custom-header-value"@@ -2742,7 +2754,7 @@ functions:```swiftlet response = try await supabase.functions.invoke(- "hello",+ "hello",options: FunctionInvokeOptions(method: .delete,headers: [@@ -2761,7 +2773,7 @@ functions:```swiftlet response = try await supabase.functions.invoke(- "hello",+ "hello",options: FunctionInvokeOptions(method: .get,headers: [@@ -2788,7 +2800,7 @@ functions:.channel("room1")channel- .on("broadcast", filter: ChannelFilter(event: "cursor-pos")) { message in+ .on("broadcast", filter: ChannelFilter(event: "cursor-pos")) { message inprint("Cursor position received!", message.payload)}.subscribe { status, error in@@ -2828,7 +2840,7 @@ functions:```swiftlet channel = supabase.realtime.channel("room1")channel- .on("presence", filter: ChannelFilter(event: "join")) { message in+ .on("presence", filter: ChannelFilter(event: "join")) { message inprint("Newly joined presences: ", message.payload)}.subscribe { status, error in@@ -2846,7 +2858,7 @@ functions:```swiftlet channel = supabase.realtime.channel("room1")channel- .on("presence", filter: ChannelFilter(event: "leave")) { message in+ .on("presence", filter: ChannelFilter(event: "leave")) { message inprint("Newly left presences: ", message.payload)}.subscribe { status, error in@@ -3097,7 +3109,7 @@ functions:```swifttry await supabase.storage.createBucket(- "avatars",+ "avatars",options: BucketOptions(public: false,allowedMimeTypes: ["image/png"],@@ -3137,7 +3149,7 @@ functions:```swifttry await supabase.storage.updateBucket(- "avatars",+ "avatars",options: BucketOptions(public: false,fileSizeLimit: 1024,diff --git a/apps/docs/spec/supabase_swift_v2.yml b/apps/docs/spec/supabase_swift_v2.ymlindex 469259bcdb0..9cfb69a2641 100644--- a/apps/docs/spec/supabase_swift_v2.yml+++ b/apps/docs/spec/supabase_swift_v2.yml@@ -1243,13 +1243,13 @@ functions:isSpotlight: truecode: |```swift- struct Country: Decodable {+ struct Instrument: Decodable {let id: Intlet name: String}- let countries: [Country] = try await supabase- .from("countries")+ let instruments: [Instrument] = try await supabase+ .from("instruments").select().execute().value@@ -1258,14 +1258,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json@@ -1273,15 +1273,15 @@ functions:"data": [{"id": 1,- "name": "Afghanistan"+ "name": "violin"},{"id": 2,- "name": "Albania"+ "name": "viola"},{"id": 3,- "name": "Algeria"+ "name": "cello"}],"status": 200,@@ -1292,12 +1292,12 @@ functions:name: Selecting specific columnscode: |```swift- struct Country: Decodable {+ struct Instrument: Decodable {let name: String}- let countries: [Country] = try await supabase- .from("countries")+ let instruments: [Instrument] = try await supabase+ .from("instruments").select("name").execute().value@@ -1306,27 +1306,27 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "violin"},{- "name": "Albania"+ "name": "viola"},{- "name": "Algeria"+ "name": "cello"}],"status": 200,@@ -1339,21 +1339,21 @@ functions:If your database has foreign key relationships, you can query related tables too.code: |```swift- struct Country: Decodable {+ struct OrchestralSection: Decodable {let name: String- let cities: [City]+ let instruments: [Instrument]}- struct City: Decodable {+ struct Instrument: Decodable {let name: String}- let countries: [Country] = try await supabase- .from("countries")+ let orchestralSections: [OrchestralSection] = try await supabase+ .from("orchestral_sections").select("""name,- cities (+ instruments (name)"""@@ -1365,42 +1365,42 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Germany",+ "name": "strings","cities": [{- "name": "Munich"+ "name": "violin"}]},{- "name": "Indonesia",+ "name": "woodwinds","cities": [{- "name": "Bali"+ "name": "flute"}]}@@ -1585,19 +1585,19 @@ functions:name: Filtering through foreign tablescode: |```swift- struct City: Decodable {+ struct Instrument: Decodable {let name: String- let countries: [Country]?+ let orchestralSections: [OrchestralSection]?}- struct Country: Decodable {+ struct OrchestralSection: Decodable {let name: String}- let cities: [City] = try await supabase- .from("cities")- .select("name, countries(*)")- .eq("countries.name", value: "Estonia")+ let instruments: [Instrument] = try await supabase+ .from("instruments")+ .select("name, orchestral_sections(*)")+ .eq("orchestral_sections.name", value: "percussion").execute().value```@@ -1605,36 +1605,36 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Bali",- "countries": null+ "name": "flute",+ "orchestral_sections": null},{- "name": "Munich",- "countries": null+ "name": "violin",+ "orchestral_sections": null}],"status": 200,@@ -1650,53 +1650,53 @@ functions:name: Querying foreign table with countcode: |```swift- struct Country: Decodable {+ struct OrchestralSection: Decodable {let id: UUIDlet name: String- let cities: [City]+ let instruments: [Instrument]}- struct City: Decodable {+ struct Instrument: Decodable {let count: Int}- let countries: [Country] = try await supabase- .from("countries")- .select("*, cities(count)")+ let orchestralSections: [OrchestralSection] = try await supabase+ .from("orchestral_sections")+ .select("*, instruments(count)").execute().value```data:sql: |```sql- create table countries (+ create table orchestral_sections ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text);- create table cities (+ create table instruments ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text,- "country_id" "uuid" references public.countries on delete cascade+ "section_id" "uuid" references public.orchestral_sections on delete cascade);- with country as (- insert into countries (name)- values ('united kingdom') returning id+ with section as (+ insert into orchestral_sections (name)+ values ('strings') returning id)- insert into cities (name, country_id) values- ('London', (select id from country)),- ('Manchester', (select id from country)),- ('Liverpool', (select id from country)),- ('Bristol', (select id from country));+ insert into instruments (name, section_id) values+ ('violin', (select id from section)),+ ('viola', (select id from section)),+ ('cello', (select id from section)),+ ('double bass', (select id from section));```response: |```json[{"id": "693694e7-d993-4360-a6d7-6294e325d9b6",- "name": "United Kingdom",- "cities": [+ "name": "strings",+ "instruments": [{"count": 4}@@ -1713,7 +1713,7 @@ functions:code: |```swiftlet count = try await supabase- .from("countries")+ .from("instruments").select("*", head: true, count: .exact).execute().count@@ -1722,14 +1722,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'dulcimer'),+ (2, 'harp'),+ (3, 'tuba');```response: |```json@@ -1777,7 +1777,7 @@ functions:insert intousers (id, name, address)values- (1, 'Avdotya', '{"city":"Saint Petersburg"}');+ (1, 'Frodo', '{"city":"Hobbiton"}');```response: |```json@@ -1785,8 +1785,8 @@ functions:"data": [{"id": 1,- "name": "Avdotya",- "city": "Saint Petersburg"+ "name": "Frodo",+ "city": "Hobbiton"}],"status": 200,@@ -1803,64 +1803,64 @@ functions:name: Querying foreign table with inner joincode: |```swift- struct City: Decodable {+ struct Instrument: Decodable {let name: String}- struct Country: Decodable {+ struct OrchestralSection: Decodable {let name: String- let cities: [City]+ let instruments: [Instrument]}- let countries: [Country] = try await supabase- .from("countries")- .select("name, cities!inner(name)")- .eq("name", value: "united kingdom")+ let orchestralSections: [OrchestralSection] = try await supabase+ .from("orchestral_sections")+ .select("name, instruments!inner(name)")+ .eq("name", value: "strings").execute().value```data:sql: |```sql- create table countries (+ create table orchestral_sections ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text);- create table cities (+ create table instruments ("id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,"name" text,- "country_id" "uuid" references public.countries on delete cascade+ "section_id" "uuid" references public.orchestral_sections on delete cascade);- with country as (- insert into countries (name)- values ('united kingdom') returning id+ with section as (+ insert into orchestral_sections (name)+ values ('strings') returning id)- insert into cities (name, country_id) values- ('London', (select id from country)),- ('Manchester', (select id from country)),- ('Liverpool', (select id from country)),- ('Bristol', (select id from country));+ insert into instruments (name, section_id) values+ ('violin', (select id from section)),+ ('viola', (select id from section)),+ ('cello', (select id from section)),+ ('double bass', (select id from section));```response: |```json{"data": [{- "name": "united kingdom",- "cities": [+ "name": "strings",+ "instruments": [{- "name": "London"+ "name": "violin"},{- "name": "Manchester"+ "name": "viola"},{- "name": "Liverpool"+ "name": "cello"},{- "name": "Bristol"+ "name": "double bass"}]}@@ -1871,7 +1871,7 @@ functions:```description: |If you don't want to return the foreign table contents, you can leave the parenthesis empty.- Like `.select('name, countries!inner()')`.+ Like `.select('name, instruments!inner()')`.hideCodeBlock: true- id: switching-schemas-per-queryname: Switching schemas per query@@ -1915,23 +1915,23 @@ functions:name: Create a recordcode: |```swift- struct Country: Encodable {+ struct Instrument: Encodable {let id: Intlet name: String}- let country = Country(id: 1, name: "Denmark")+ let instrument = Instrument(id: 1, name: "ukelele")try await supabase- .from("countries")- .insert(country)+ .from("instruments")+ .insert(instrument).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);```response: |```json@@ -1946,14 +1946,14 @@ functions:name: Create a record and return itcode: |```swift- struct Country: Codable {+ struct Instrument: Codable {let id: Intlet name: String}- let country: Country = try await supabase- .from("countries")- .insert(Country(id: 1, name: "Denmark"))+ let instrument: Instrument = try await supabase+ .from("instruments")+ .insert(Instrument(id: 1, name: "banjo")).select()// specify you want a single value returned, otherwise it returns a list..single()@@ -1964,7 +1964,7 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);```response: |```json@@ -1972,7 +1972,7 @@ functions:"data": [{"id": 1,- "name": "Denmark"+ "name": "banjo"}],"status": 201,@@ -1984,26 +1984,26 @@ functions:name: Bulk createcode: |```swift- struct Country: Encodable {+ struct Instrument: Encodable {let id: Intlet name: String}- let countries = [- Country(id: 1, name: "Nepal"),- Country(id: 1, name: "Vietnam"),+ let instruments = [+ Instrument(id: 1, name: "xylophone"),+ Instrument(id: 1, name: "tuba"),]try await supabase- .from("countries")- .insert(countries)+ .from("instruments")+ .insert(instruments).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);```response: |```json@@ -2012,7 +2012,7 @@ functions:"code": "23505","details": "Key (id)=(1) already exists.","hint": null,- "message": "duplicate key value violates unique constraint \"countries_pkey\""+ "message": "duplicate key value violates unique constraint \"instruments_pkey\""},"status": 409,"statusText": "Conflict"@@ -2033,8 +2033,8 @@ functions:code: |```swifttry await supabase- .from("countries")- .update(["name": "Australia"])+ .from("instruments")+ .update(["name": "piano"]).eq("id", value: 1).execute()```@@ -2046,12 +2046,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Taiwan');+ (1, 'harpsichord');```response: |```json@@ -2066,14 +2066,14 @@ functions:name: Update a record and return itcode: |```swift- struct Country: Decodable {+ struct Instrument: Decodable {let id: Intlet name: String}- let country: Country = try await supabase- .from("countries")- .update(["name": "Australia"])+ let instrument: Instrument = try await supabase+ .from("instruments")+ .update(["name": "piano"]).eq("id", value: 1).select()// If you know this query should return a single object, append a `single()` modifier to it.@@ -2085,12 +2085,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Taiwan');+ (1, 'harpsichord');```response: |```json@@ -2098,7 +2098,7 @@ functions:"data": [{"id": 1,- "name": "Australia"+ "name": "piano"}],"status": 200,@@ -2187,25 +2187,25 @@ functions:name: Upsert your datacode: |```swift- struct Country: Encodable {+ struct Instrument: Encodable {let id: Intlet name: String}try await supabase- .from("countries")- .upsert(Country(id: 1, name: "Albania"))+ .from("instruments")+ .upsert(Instrument(id: 1, name: "piano")).execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json@@ -2213,7 +2213,7 @@ functions:"data": [{"id": 1,- "name": "Albania"+ "name": "piano"}],"status": 201,@@ -2226,15 +2226,15 @@ functions:name: Bulk Upsert your datacode: |```swift- struct Country: Encodable {+ struct Instrument: Encodable {let id: Intlet name: String}try await supabase- .from("countries")+ .from("instruments").upsert([- Country(id: 1, name: "Albania"),- Country(id: 2, name: "Algeria"),+ Instrument(id: 1, name: "piano"),+ Instrument(id: 2, name: "harp"),]).execute()```@@ -2242,12 +2242,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json@@ -2255,11 +2255,11 @@ functions:"data": [{"id": 1,- "name": "Albania"+ "name": "piano"},{"id": 2,- "name": "Algeria"+ "name": "harp"}],"status": 201,@@ -2344,7 +2344,7 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").delete().eq("id", value: 1).execute()@@ -2353,12 +2353,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Spain');+ (1, 'mandolin');```response: |```json@@ -2469,13 +2469,13 @@ functions:name: Call a Postgres function with filterscode: |```swift- struct Country: Decodable {+ struct Instrument: Decodable {let id: Intlet name: String}- let country: Country = await supabase- .rpc("list_stored_countries")+ let instrument: Instrument = await supabase+ .rpc("list_stored_instruments").eq("id", value: 1).single().execute()@@ -2485,13 +2485,13 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'France'),- (2, 'United Kingdom');+ (1, 'klaxon'),+ (2, 'marimba');create function list_stored_countries() returns setof countries as $$select * from countries;@@ -2502,7 +2502,7 @@ functions:{"data": {"id": 1,- "name": "France"+ "name": "klaxon"},"status": 200,"statusText": "OK"@@ -2633,49 +2633,49 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("orchestral_sections").select("""name,- cities!inner (+ instruments!inner (name)""")- .eq("cities.name", value: "Bali")+ .eq("instruments.name", value: "flute")```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",- "cities": [+ "name": "woodwinds",+ "instruments": [{- "name": "Bali"+ "name": "flute"}]}@@ -2702,32 +2702,32 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select("name")- .or("id.eq.2,name.eq.Algeria")+ .or("id.eq.2,name.eq.cello")```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{"data": [{- "name": "Albania"+ "name": "viola"},{- "name": "Algeria"+ "name": "cello"}],"status": 200,@@ -2741,29 +2741,29 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select("name")- .or("id.gt.3,and(id.eq.1,name.eq.Afghanistan)")+ .or("id.gt.3,and(id.eq.1,name.eq.violin)")```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```reponse: |```json{"data": [{- "name": "Afghanistan"+ "name": "violin"}],"status": 200,@@ -2780,7 +2780,7 @@ functions:- `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values.```swift- .not("name", operator: .eq, value: "Paris")+ .not("name", operator: .eq, value: "violin").not("arraycol", operator: .cs, value: #"{"a","b"}"#) // Use Postgres array {} for array column and 'cs' for contains..not("rangecol", operator: .cs, value: "(1,2]") // Use Postgres range syntax for range column..not("id", operator: .in, value: "(6,7)") // Use Postgres list () and 'in' for in_ filter.@@ -2793,7 +2793,7 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select().not("name", operator: .is, value: "").execute()@@ -2807,29 +2807,29 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select("name")- .match(["id": 2, "name": "Albania"])+ .match(["id": 2, "name": "viola"])```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{"data": [{- "name": "Albania"+ "name": "viola"}],"status": 200,@@ -2854,22 +2854,22 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select()- .filter("name", operator: "in", value: #"("Algeria","Japan")"#)+ .filter("name", operator: "in", value: #"("cello","guzheng")"#)```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json@@ -2877,7 +2877,7 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "cello"}],"status": 200,@@ -2891,49 +2891,49 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("orchestral_sections").select("""name,- cities!inner (+ instruments!inner (name)""")- .filter("cities.name", operator: "eq", value: "Bali")+ .filter("instruments.name", operator: "eq", value: "flute")```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 2, 'Bali'),- (2, 1, 'Munich');+ (1, 2, 'flute'),+ (2, 1, 'violin');```response: |```json{"data": [{- "name": "Indonesia",+ "name": "woodwinds","cities": [{- "name": "Bali"+ "name": "flute"}]}@@ -2965,8 +2965,8 @@ functions:code: |```swifttry await supabase- .from("countries")- .upsert(CountryModel(id: 1, name: "Algeria"))+ .from("instruments")+ .upsert(InstrumentModel(id: 1, name: "piano")).select().execute()```@@ -2974,12 +2974,12 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan');+ (1, 'harpsichord');```response: |```json@@ -2987,7 +2987,7 @@ functions:"data": [{"id": 1,- "name": "Algeria"+ "name": "piano"}],"status": 201,@@ -3006,7 +3006,7 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select("id, name").order("id", ascending: false).execute()@@ -3015,14 +3015,14 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```swifton@@ -3030,15 +3030,15 @@ functions:"data": [{"id": 3,- "name": "Algeria"+ "name": "cello"},{"id": 2,- "name": "Albania"+ "name": "viola"},{"id": 1,- "name": "Afghanistan"+ "name": "viola"}],"status": 200,@@ -3052,58 +3052,58 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("orchestral_sections").select("""name,- cities (+ instruments (name)""")- .order("name", ascending: false, referencedTable: "cities")+ .order("name", ascending: false, referencedTable: "instruments").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States'),- (2, 'Vanuatu');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'harp'),+ (2, 1, 'violin');```response: |```swifton{"data": [{- "name": "United States",+ "name": "strings","cities": [{- "name": "New York City"+ "name": "violin"},{- "name": "Atlanta"+ "name": "harp"}]},{- "name": "Vanuatu",+ "name": "woodwinds","cities": []}],@@ -3120,51 +3120,51 @@ functions:code: |```swifttry await supabase- .from("cities")+ .from("instruments").select("""name,- country:countries (+ section:orchestral_sections (name)""")- .order("country(name)", ascending: true)+ .order("section(name)", ascending: true)```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'Germany'),- (2, 'Indonesia');+ (1, 'strings'),+ (2, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Munich'),- (2, 2, 'Bali');+ (1, 1, 'violin'),+ (2, 2, 'flute');```response: |```swifton{"data": [{- "name": "Munich",- "country": { "name": "Germany" }+ "name": "violin",+ "country": { "name": "strings" }},{- "name": "Bali",- "country": { "name": "Indonesia" }+ "name": "flute",+ "country": { "name": "woodwinds" }}],"status": 200,@@ -3186,7 +3186,7 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select("id, name").limit(1).execute()@@ -3195,21 +3195,21 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{"data": [{- "name": "Afghanistan"+ "name": "violin"}],"status": 200,@@ -3223,49 +3223,49 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("orchestral_sections").select("""name,- cities (+ instruments (name)""")- .limit(1, referencedTable: "cities")+ .limit(1, referencedTable: "instruments").execute()```data:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ orchestral_sections (id int8 primary key, name text);create table- cities (+ instruments (id int8 primary key,- country_id int8 not null references countries,+ section_id int8 not null references orchestral_sections,name text);insert into- countries (id, name)+ orchestral_sections (id, name)values- (1, 'United States');+ (1, 'woodwinds');insert into- cities (id, country_id, name)+ instruments (id, section_id, name)values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');+ (1, 1, 'flute'),+ (2, 1, 'oboe');```response: |```json{"data": [{- "name": "United States",+ "name": "woodwinds","cities": [{- "name": "Atlanta"+ "name": "flute"}]}@@ -3285,15 +3285,8 @@ functions:code: |```swifttry await supabase- .from("countries")- .select(- """- name,- cities (- name- )- """- )+ .from("instruments")+ .select("name").range(from: 0, to: 1).execute()```@@ -3301,24 +3294,24 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```swifton{"data": [{- "name": "Afghanistan"+ "name": "violin"},{- "name": "Albania"+ "name": "viola"}],"status": 200,@@ -3338,7 +3331,7 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select("name").limit(1).single()@@ -3348,20 +3341,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{"data": {- "name": "Afghanistan"+ "name": "violin"},"status": 200,"statusText": "OK"@@ -3377,7 +3370,7 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select().csv().execute()@@ -3386,19 +3379,19 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```json{- "data": "id,name\n1,Afghanistan\n2,Albania\n3,Algeria",+ "data": "id,name\n1,violin\n2,viola\n3,cello","status": 200,"statusText": "OK"}@@ -3423,7 +3416,7 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select().explain().execute()@@ -3433,20 +3426,20 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```Aggregate (cost=33.34..33.36 rows=1 width=112)-> Limit (cost=0.00..18.33 rows=1000 width=40)- -> Seq Scan on countries (cost=0.00..22.00 rows=1200 width=40)+ -> Seq Scan on instruments (cost=0.00..22.00 rows=1200 width=40)```description: |By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.@@ -3458,7 +3451,7 @@ functions:code: |```swifttry await supabase- .from("countries")+ .from("instruments").select().explain(analyze: true,@@ -3471,23 +3464,23 @@ functions:sql: |```sqlcreate table- countries (id int8 primary key, name text);+ instruments (id int8 primary key, name text);insert into- countries (id, name)+ instruments (id, name)values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');+ (1, 'violin'),+ (2, 'viola'),+ (3, 'cello');```response: |```Aggregate (cost=33.34..33.36 rows=1 width=112) (actual time=0.041..0.041 rows=1 loops=1)- Output: NULL::bigint, count(ROW(countries.id, countries.name)), COALESCE(json_agg(ROW(countries.id, countries.name)), '[]'::json), NULLIF(current_setting('response.headers'::text, true), ''::text), NULLIF(current_setting('response.status'::text, true), ''::text)+ Output: NULL::bigint, count(ROW(instruments.id, instruments.name)), COALESCE(json_agg(ROW(instruments.id, instruments.name)), '[]'::json), NULLIF(current_setting('response.headers'::text, true), ''::text), NULLIF(current_setting('response.status'::text, true), ''::text)-> Limit (cost=0.00..18.33 rows=1000 width=40) (actual time=0.005..0.006 rows=3 loops=1)- Output: countries.id, countries.name- -> Seq Scan on public.countries (cost=0.00..22.00 rows=1200 width=40) (actual time=0.004..0.005 rows=3 loops=1)- Output: countries.id, countries.name+ Output: instruments.id, instruments.name+ -> Seq Scan on public.instruments (cost=0.00..22.00 rows=1200 width=40) (actual time=0.004..0.005 rows=3 loops=1)+ Output: instruments.id, instruments.nameQuery Identifier: -4730654291623321173Planning Time: 0.407 msExecution Time: 0.119 ms