Skip to content

Example on "upsert into tables with constraint" is wrong #911

Open
@wecessary

Description

@wecessary

Improve documentation

Link

https://supabase.com/docs/reference/javascript/upsert?example=upserting-into-tables-with-constraints

Describe the problem

The example says that an error will be thrown. But the operation would actually successfully update the row to (42, 'saoirse', 'Saoirse'). Because ignoreDuplicates defaults to false. and the example operation specifies { onConflict: 'handle' }. Therefore it should find row (1, 'saoirse', null) and merge into it.

Describe the improvement

Update the example. I think the example was meant to refer to the case when { onConflict: 'handle' } is NOT specified.
Also the doc currently doesn't say what the optional parameters default to.

P.S

I hope I am right about this - otherwise I would be very confused about how upsert works with the client!

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions