cloud-sql-postgres-data
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUsage
使用方法
All scripts can be executed using Node.js. Replace and with actual values.
<param_name><param_value>Bash:
node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'PowerShell:
node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence.
所有脚本均可通过Node.js执行。将和替换为实际值。
<param_name><param_value>Bash:
node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'PowerShell:
node <skill_dir>/scripts/<script_name>.js '{\\\"<param_name>\\\": \\\"<param_value>\\\"}'注意:脚本会自动从各种.env文件加载环境变量。除非因缺少环境变量导致技能执行失败,否则不要要求用户设置变量。
Scripts
脚本
execute_sql
execute_sql
Use this tool to execute a single SQL statement.
使用此工具执行单条SQL语句。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| sql | string | The sql to execute. | Yes |
| 名称 | 类型 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|---|
| sql | string | 要执行的SQL语句。 | 是 |
list_indexes
list_indexes
Lists available user indexes in the database, excluding system schemas (pg_catalog, information_schema). For each index, the following properties are returned: schema name, table name, index name, index type (access method), a boolean indicating if it's a unique index, a boolean indicating if it's for a primary key, the index definition, index size in bytes, the number of index scans, the number of index tuples read, the number of table tuples fetched via index scans, and a boolean indicating if the index has been used at least once.
列出数据库中可用的用户indexes,排除系统schemas(pg_catalog、information_schema)。每个index返回以下属性:schema名称、table名称、index名称、index类型(访问方法)、表示是否为唯一index的布尔值、表示是否为主键的布尔值、index定义、index大小(字节)、index扫描次数、读取的index元组数量、通过index扫描获取的table元组数量、以及表示index是否至少被使用过一次的布尔值。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| schema_name | string | Optional: a text to filter results by schema name. The input is used within a LIKE clause. | No | `` |
| table_name | string | Optional: a text to filter results by table name. The input is used within a LIKE clause. | No | `` |
| index_name | string | Optional: a text to filter results by index name. The input is used within a LIKE clause. | No | `` |
| only_unused | boolean | Optional: If true, only returns indexes that have never been used. | No | |
| limit | integer | Optional: The maximum number of rows to return. Default is 50 | No | |
| 名称 | 类型 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|---|
| schema_name | string | 可选:用于按schema名称过滤结果的文本,输入将用于LIKE子句中。 | 否 | `` |
| table_name | string | 可选:用于按table名称过滤结果的文本,输入将用于LIKE子句中。 | 否 | `` |
| index_name | string | 可选:用于按index名称过滤结果的文本,输入将用于LIKE子句中。 | 否 | `` |
| only_unused | boolean | 可选:如果为true,仅返回从未被使用过的indexes。 | 否 | |
| limit | integer | 可选:返回的最大行数,默认值为50 | 否 | |
list_schemas
list_schemas
Lists all schemas in the database ordered by schema name and excluding system and temporary schemas. It returns the schema name, schema owner, grants, number of functions, number of tables and number of views within each schema.
列出数据库中所有schemas,按schema名称排序,排除系统和临时schemas。返回每个schema的名称、schema所有者、权限、函数数量、表数量和视图数量。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| schema_name | string | Optional: A specific schema name pattern to search for. | No | `` |
| owner | string | Optional: A specific schema owner name pattern to search for. | No | `` |
| limit | integer | Optional: The maximum number of schemas to return. | No | |
| 名称 | 类型 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|---|
| schema_name | string | 可选:要搜索的特定schema名称模式。 | 否 | `` |
| owner | string | 可选:要搜索的特定schema所有者名称模式。 | 否 | `` |
| limit | integer | 可选:返回的最大schemas数量。 | 否 | |
list_sequences
list_sequences
Lists sequences in the database. Returns sequence name, schema name, sequence owner, data type of the sequence, starting value, minimum value, maximum value of the sequence, the value by which the sequence is incremented, and the last value generated by the sequence in the current session
列出数据库中的sequences。返回sequence名称、schema名称、sequence所有者、sequence的数据类型、起始值、最小值、最大值、sequence的增量值,以及当前会话中sequence生成的最后一个值。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| schema_name | string | Optional: A specific schema name pattern to search for. | No | `` |
| sequence_name | string | Optional: A specific sequence name pattern to search for. | No | `` |
| limit | integer | Optional: The maximum number of rows to return. Default is 50 | No | |
| 名称 | 类型 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|---|
| schema_name | string | 可选:要搜索的特定schema名称模式。 | 否 | `` |
| sequence_name | string | 可选:要搜索的特定sequence名称模式。 | 否 | `` |
| limit | integer | 可选:返回的最大行数,默认值为50 | 否 | |
list_stored_procedure
list_stored_procedure
Retrieves stored procedure metadata returning schema name, procedure name, procedure owner, language, definition, and description, filtered by optional role name (procedure owner), schema name, and limit (default 20).
检索stored procedure元数据,返回schema名称、procedure名称、procedure所有者、语言、定义和描述,可按可选的角色名称(procedure所有者)、schema名称和数量限制(默认20)过滤。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| role_name | string | Optional: The owner name to filter the stored procedures by. Defaults to NULL. | No | |
| schema_name | string | Optional: The schema name to filter the stored procedures by. Defaults to NULL. | No | |
| limit | integer | Optional: The maximum number of stored procedures to return. Defaults to 20. | No | |
| 名称 | 类型 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|---|
| role_name | string | 可选:用于过滤stored procedure的所有者名称,默认值为NULL。 | 否 | |
| schema_name | string | 可选:用于过滤stored procedure的schema名称,默认值为NULL。 | 否 | |
| limit | integer | 可选:返回的最大stored procedure数量,默认值为20。 | 否 | |
list_tables
list_tables
Lists detailed schema information (object type, columns, constraints, indexes, triggers, owner, comment) as JSON for user-created tables (ordinary or partitioned). Filters by a comma-separated list of names. If names are omitted, lists all tables in user schemas.
列出用户创建的表(普通表或分区表)的详细schema信息(对象类型、列、约束、indexes、triggers、所有者、注释),以JSON格式返回。可按逗号分隔的名称列表过滤。如果未指定名称,则列出用户schemas中的所有表。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| table_names | string | Optional: A comma-separated list of table names. If empty, details for all tables will be listed. | No | `` |
| output_format | string | Optional: Use 'simple' for names only or 'detailed' for full info. | No | |
| 名称 | 类型 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|---|
| table_names | string | 可选:逗号分隔的表名称列表。如果为空,则列出所有表的详细信息。 | 否 | `` |
| output_format | string | 可选:使用'simple'仅返回名称,使用'detailed'返回完整信息。 | 否 | |
list_triggers
list_triggers
Lists all non-internal triggers in a database. Returns trigger name, schema name, table name, whether its enabled or disabled, timing (e.g BEFORE/AFTER of the event), the events that cause the trigger to fire such as INSERT, UPDATE, or DELETE, whether the trigger activates per ROW or per STATEMENT, the handler function executed by the trigger and full definition.
列出数据库中所有非内部triggers。返回trigger名称、schema名称、table名称、是否启用、触发时机(如事件之前/之后)、触发事件(如INSERT、UPDATE或DELETE)、trigger是按行还是按语句激活、trigger执行的处理函数以及完整定义。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| trigger_name | string | Optional: A specific trigger name pattern to search for. | No | `` |
| schema_name | string | Optional: A specific schema name pattern to search for. | No | `` |
| table_name | string | Optional: A specific table name pattern to search for. | No | `` |
| limit | integer | Optional: The maximum number of rows to return. | No | |
| 名称 | 类型 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|---|
| trigger_name | string | 可选:要搜索的特定trigger名称模式。 | 否 | `` |
| schema_name | string | 可选:要搜索的特定schema名称模式。 | 否 | `` |
| table_name | string | 可选:要搜索的特定table名称模式。 | 否 | `` |
| limit | integer | 可选:返回的最大行数。 | 否 | |
list_views
list_views
Lists views in the database from pg_views with a default limit of 50 rows. Returns schemaname, viewname, ownername and the definition.
列出数据库中来自pg_views的views,默认返回50行。返回schema名称、view名称、所有者名称和定义。
Parameters
参数
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| view_name | string | Optional: A specific view name to search for. | No | `` |
| schema_name | string | Optional: A specific schema name to search for. | No | `` |
| limit | integer | Optional: The maximum number of rows to return. | No | |
| 名称 | 类型 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|---|
| view_name | string | 可选:要搜索的特定view名称。 | 否 | `` |
| schema_name | string | 可选:要搜索的特定schema名称。 | 否 | `` |
| limit | integer | 可选:返回的最大行数。 | 否 | |