Insert data
Perform an INSERT into the table or view.
Parameters
values
REQUIRED
object[]The values to insert. Pass an object to insert a single row or an array to insert multiple rows.
options
Optional
objectNamed parameters
count
Optional
"exact" | "planned" | "estimated"Count algorithm to use to count inserted rows. `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood. `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood. `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
defaultToNull
Optional
booleanMake missing fields default to `null`. Otherwise, use the default value for the column. Only applies for bulk inserts.
const { error } = await supabase
.from('countries')
.insert({ id: 1, name: 'Denmark' })