Execute DDL
kb_execute_ddlExecute DDL statements like CREATE, ALTER, DROP, and TRUNCATE on a KingBase database, with automatic schema qualification for unqualified table names.
Instructions
Execute a DDL statement (CREATE, ALTER, DROP, TRUNCATE, etc.) against the KingBase database.
WARNING: DDL operations modify database structure and can be destructive. DROP and TRUNCATE operations are irreversible.
š Auto-schema feature: Unqualified table names (without schema prefix) are automatically qualified with the configured schema (DB_SCHEMA env var). You can optionally override this with the 'schema' parameter.
Args:
sql (string): The DDL statement to execute
schema (string, optional): Override the default schema for auto-qualifying table names
Returns: Confirmation message. For dangerous operations (DROP/TRUNCATE/CASCADE), a warning is included.
Examples:
sql: "CREATE TABLE test (id SERIAL PRIMARY KEY, name VARCHAR(100))"
sql: "ALTER TABLE users ADD COLUMN phone VARCHAR(20)"
sql: "CREATE INDEX idx_users_email ON users(email)"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | DDL statement (CREATE/ALTER/DROP/TRUNCATE) to execute | |
| schema | No | Schema name for tables without explicit schema prefix (default: from DB_SCHEMA env or 'public') |