Skip to content

Missing WHERE clause in Bulk APIs #1421

Closed
@fishnux

Description

@fishnux

This is a critical bug because, even if the query succeeds, it'll update rows you don't want to update (all of them)

NocoDB used as docker : true
NocoDB version : 0.84.14
Database used in NC_DB URL : sqlite3
Project was created by clicking : New Project by connecting to external database
Database on which spreadsheet is created : pg
OS on which NocoDB is running : Linux
Node.js version if running as node : N/A
Database version :

Steps To Reproduce
Do REST API request to bulk update, e.g.

[
    {
        "id": 2,
        "email": "example@example.com"
    },
    {
        "id": 3,
        "email": "example2@example.com"
    }
]

(please note I haven't literally tested the example above, I found this bug within n8n's NocoDB integration)

Expected behavior
Bulk update succeeds

What happens

error: update "mytable" set "id" = $1, "email" = $2 - duplicate key value violates unique constraint "mytable_pkey"

It's missing the WHERE clause for UPDATE - all rows would be updated if the query succeeds

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✨ Type: EnhancementSome new changes adding on the existing functionality to make better.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions