Execute SQL in one PostgreSQL Database as one transaction with database_sql:write. Supports INSERT, CREATE TABLE/INDEX; other supported changes need yes: true after explicit authorization. Check the exact Database and connected production workloads before changes. Returns a SQL Run; use database_sql_show. Reuse request_key after transport failure; never retry an unknown outcome with a new key.
Arguments
| Argument |
Type |
Description |
database |
string |
Exact Database id, not Database instance id. Required. |
statements |
string list |
One server-parsed statement per entry. No transaction control, COPY, function/procedure definitions, roles or shell commands. Required. |
request_key |
string |
Unique request identity; reuse for the same SQL request across retries. Required. |
yes |
boolean |
Explicit authorization for UPDATE, DELETE, MERGE, TRUNCATE, ALTER/DROP TABLE/INDEX or SQL outside additive INSERT/CREATE. |
timeout_seconds |
integer |
— |
max_rows |
integer |
— |
Example
{"database":"database-100","request_key":"create_contacts_001","statements":["CREATE TABLE public.test_contacts (id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text)"]}