Optional
body?: unknownOptional
fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>)Optional
init: RequestInitOptional
isOptional
schema?: stringOptional
shouldOptional
signal?: AbortSignalProtected
Optional
bodyProtected
fetchOptional
init: RequestInitProtected
headersProtected
isProtected
methodProtected
Optional
schemaProtected
shouldProtected
Optional
signalProtected
urlThe AbortSignal to use for the fetch request
Return data
as a string in CSV format.
Return data
as the EXPLAIN plan for the query.
You need to enable the db_plan_enabled setting before using this method.
Named parameters
Optional
analyze?: booleanIf true
, the query will be executed and the
actual run time will be returned
Optional
buffers?: booleanIf true
, include information on buffer usage
Optional
format?: "text" | "json"The format of the output, can be "text"
(default)
or "json"
Optional
settings?: booleanIf true
, include information on configuration
parameters that affect query planning
Optional
verbose?: booleanIf true
, the query identifier will be returned
and data
will include the output columns of the query
Optional
wal?: booleanIf true
, include information on WAL record generation
Return data
as an object in GeoJSON format.
Limit the query result by count
.
The maximum number of rows to return
Named parameters
Optional
foreignDeprecated, use options.referencedTable
instead
Optional
referencedSet this to limit rows of referenced tables instead of the parent table
Set the maximum number of rows that can be affected by the query. Only available in PostgREST v13+ and only works with PATCH and DELETE methods.
The maximum number of rows that can be affected
Return data
as a single object instead of an array of objects.
Query result must be zero or one row (e.g. using .limit(1)
), otherwise
this returns an error.
Order the query result by column
.
You can call this method multiple times to order by multiple columns.
You can order referenced tables, but it only affects the ordering of the
parent table if you use !inner
in the query.
The column to order by
Optional
options: { Named parameters
Optional
ascending?: booleanIf true
, the result will be in ascending order
Optional
nullsIf true
, null
s appear first. If false
,
null
s appear last.
Optional
referencedSet this to order a referenced table by its columns
Order the query result by column
.
You can call this method multiple times to order by multiple columns.
You can order referenced tables, but it only affects the ordering of the
parent table if you use !inner
in the query.
The column to order by
Optional
options: { Named parameters
Optional
ascending?: booleanIf true
, the result will be in ascending order
Optional
nullsIf true
, null
s appear first. If false
,
null
s appear last.
Optional
referencedSet this to order a referenced table by its columns
Use options.referencedTable
instead of options.foreignTable
Optional
options: { Optional
ascending?: booleanOptional
foreignOptional
nullsUse options.referencedTable
instead of options.foreignTable
Optional
options: { Optional
ascending?: booleanOptional
foreignOptional
nullsOverride the type of the returned data
field in the response.
// Merge with existing types (default behavior)
const query = supabase
.from('users')
.select()
.overrideTypes<{ custom_field: string }>()
// Replace existing types completely
const replaceQuery = supabase
.from('users')
.select()
.overrideTypes<{ id: number; name: string }, { merge: false }>()
A PostgrestBuilder instance with the new type
The new type to cast the response data to
Optional type configuration (defaults to { merge: true })
Limit the query result by starting at an offset from
and ending at the offset to
.
Only records within this range are returned.
This respects the query order and if there is no order clause the range could behave unexpectedly.
The from
and to
values are 0-based and inclusive: range(1, 3)
will include the second, third
and fourth rows of the query.
The starting index from which to limit the result
The last index to which to limit the result
Named parameters
Optional
foreignDeprecated, use options.referencedTable
instead
Optional
referencedSet this to limit rows of referenced tables instead of the parent table
Override the type of the returned data
.
Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead
The new result type to override with
Rollback the query.
data
will still be returned, but the query is not committed.
Perform a SELECT on the query result.
By default, .insert()
, .update()
, .upsert()
, and .delete()
do not
return modified rows. By calling this method, modified rows are returned in
data
.
Optional
columns: QueryThe columns to retrieve, separated by commas
Set an HTTP header for the request.
Return data
as a single object instead of an array of objects.
Query result must be one row (e.g. using .limit(1)
), otherwise this
returns an error.
Optional
onfulfilled: null | ((value: PostgrestSingleResponse<Result>) => TResult1 | PromiseLike<TResult1>)Optional
onrejected: null | ((reason: any) => TResult2 | PromiseLike<TResult2>)If there's an error with the query, throwOnError will reject the promise by throwing the error instead of returning it as part of a successful response.
Generated using TypeDoc
Set the AbortSignal for the fetch request.