pg_execute_sql
Execute any valid PostgreSQL SQL statements with parameterized inputs, transaction control, and customizable timeouts for efficient database operations.
Instructions
Execute arbitrary SQL statements - sql="ANY_VALID_SQL" with optional parameters and transaction support. Examples: sql="CREATE INDEX ...", sql="WITH complex_cte AS (...) SELECT ...", transactional=true
Input Schema
Name | Required | Description | Default |
---|---|---|---|
connectionString | No | PostgreSQL connection string (optional) | |
expectRows | No | Whether to expect rows back (false for statements like CREATE, DROP, etc.) | |
parameters | No | Parameter values for prepared statement placeholders ($1, $2, etc.) | |
sql | Yes | SQL statement to execute (can be any valid PostgreSQL SQL) | |
timeout | No | Query timeout in milliseconds | |
transactional | No | Whether to wrap in a transaction |