pg_execute_mutation
Execute PostgreSQL data modifications (INSERT, UPDATE, DELETE, UPSERT) directly by specifying table, operation, and data. Supports WHERE clauses, conflict resolution, and returning modified rows for efficient data management.
Instructions
Execute data modification operations (INSERT/UPDATE/DELETE/UPSERT) - operation="insert/update/delete/upsert" with table and data. Examples: operation="insert", table="users", data={"name":"John","email":"john@example.com"}
Input Schema
Name | Required | Description | Default |
---|---|---|---|
conflictColumns | No | Columns for conflict resolution in upsert (ON CONFLICT) | |
connectionString | No | PostgreSQL connection string (optional) | |
data | No | Data object with column-value pairs (required for insert/update/upsert) | |
operation | Yes | Mutation operation: insert (add rows), update (modify rows), delete (remove rows), upsert (insert or update) | |
returning | No | RETURNING clause to get back inserted/updated data | |
schema | No | Schema name (defaults to public) | public |
table | Yes | Table name for the operation | |
where | No | WHERE clause for update/delete operations (without WHERE keyword) |