# Cloud SQL Postgres Data

> Use these skills when you need to explore the database structure, discover schema objects like views or stored procedures, and execute custom SQL queries to interact with your data.

- Skill: `tmolavi/cloud-sql-postgres-data` (Agent Skill, multi-file: 9 files)
- Install (CLI): `npx skillmds@latest add tmolavi/cloud-sql-postgres-data`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tmolavi/cloud-sql-postgres-data/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- License: Apache-2.0
- Author: tmolavi (https://skillmd.com/u/tmolavi)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/tmolavi/cloud-sql-postgres-data

---


## Usage

All scripts can be executed using Node.js. Replace `<param_name>` and
`<param_value>` with actual values.

**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.

## Scripts

### execute_sql

Use this tool to execute a single SQL statement.

#### Parameters

Name | Type   | Description         | Required | Default
:--- | :----- | :------------------ | :------- | :------
sql  | string | The sql to execute. | Yes      |

--------------------------------------------------------------------------------

### 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.

#### Parameters

| Name        | Type    | Description                     | Required | Default |
| :---------- | :------ | :------------------------------ | :------- | :------ |
| schema_name | string  | Optional: a text to filter      | No       | ``      |
:             :         : results by schema name. The     :          :         :
:             :         : input is used within a LIKE     :          :         :
:             :         : clause.                         :          :         :
| table_name  | string  | Optional: a text to filter      | No       | ``      |
:             :         : results by table name. The      :          :         :
:             :         : input is used within a LIKE     :          :         :
:             :         : clause.                         :          :         :
| index_name  | string  | Optional: a text to filter      | No       | ``      |
:             :         : results by index name. The      :          :         :
:             :         : input is used within a LIKE     :          :         :
:             :         : clause.                         :          :         :
| only_unused | boolean | Optional: If true, only returns | No       | `false` |
:             :         : indexes that have never been    :          :         :
:             :         : used.                           :          :         :
| limit       | integer | Optional: The maximum number of | No       | `50`    |
:             :         : rows to return. Default is 50   :          :         :

--------------------------------------------------------------------------------

### 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.

#### Parameters

| Name        | Type    | Description                     | Required | Default |
| :---------- | :------ | :------------------------------ | :------- | :------ |
| schema_name | string  | Optional: A specific schema     | No       | ``      |
:             :         : name pattern to search for.     :          :         :
| owner       | string  | Optional: A specific schema     | No       | ``      |
:             :         : owner name pattern to search    :          :         :
:             :         : for.                            :          :         :
| limit       | integer | Optional: The maximum number of | No       | `10`    |
:             :         : schemas to return.              :          :         :

--------------------------------------------------------------------------------

### 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

#### Parameters

| Name          | Type    | Description                   | Required | Default |
| :------------ | :------ | :---------------------------- | :------- | :------ |
| schema_name   | string  | Optional: A specific schema   | No       | ``      |
:               :         : name pattern to search for.   :          :         :
| sequence_name | string  | Optional: A specific sequence | No       | ``      |
:               :         : name pattern to search for.   :          :         :
| limit         | integer | Optional: The maximum number  | No       | `50`    |
:               :         : of rows to return. Default is :          :         :
:               :         : 50                            :          :         :

--------------------------------------------------------------------------------

### 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).

#### Parameters

| Name        | Type    | Description                     | Required | Default |
| :---------- | :------ | :------------------------------ | :------- | :------ |
| role_name   | string  | Optional: The owner name to     | No       |         |
:             :         : filter the stored procedures    :          :         :
:             :         : by. Defaults to NULL.           :          :         :
| schema_name | string  | Optional: The schema name to    | No       |         |
:             :         : filter the stored procedures    :          :         :
:             :         : by. Defaults to NULL.           :          :         :
| limit       | integer | Optional: The maximum number of | No       | `20`    |
:             :         : stored procedures to return.    :          :         :
:             :         : Defaults to 20.                 :          :         :

--------------------------------------------------------------------------------

### 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.

#### Parameters

| Name          | Type   | Description     | Required | Default    |
| :------------ | :----- | :-------------- | :------- | :--------- |
| table_names   | string | Optional: A     | No       | ``         |
:               :        : comma-separated :          :            :
:               :        : list of table   :          :            :
:               :        : names. If       :          :            :
:               :        : empty, details  :          :            :
:               :        : for all tables  :          :            :
:               :        : will be listed. :          :            :
| output_format | string | Optional: Use   | No       | `detailed` |
:               :        : 'simple' for    :          :            :
:               :        : names only or   :          :            :
:               :        : 'detailed' for  :          :            :
:               :        : full info.      :          :            :

--------------------------------------------------------------------------------

### 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.

#### Parameters

| Name         | Type    | Description                  | Required | Default |
| :----------- | :------ | :--------------------------- | :------- | :------ |
| trigger_name | string  | Optional: A specific trigger | No       | ``      |
:              :         : name pattern to search for.  :          :         :
| schema_name  | string  | Optional: A specific schema  | No       | ``      |
:              :         : name pattern to search for.  :          :         :
| table_name   | string  | Optional: A specific table   | No       | ``      |
:              :         : name pattern to search for.  :          :         :
| limit        | integer | Optional: The maximum number | No       | `50`    |
:              :         : of rows to return.           :          :         :

--------------------------------------------------------------------------------

### list_views

Lists views in the database from pg_views with a default limit of 50 rows.
Returns schemaname, viewname, ownername and the definition.

#### Parameters

| Name        | Type    | Description                     | Required | Default |
| :---------- | :------ | :------------------------------ | :------- | :------ |
| view_name   | string  | Optional: A specific view name  | No       | ``      |
:             :         : to search for.                  :          :         :
| schema_name | string  | Optional: A specific schema     | No       | ``      |
:             :         : name to search for.             :          :         :
| limit       | integer | Optional: The maximum number of | No       | `50`    |
:             :         : rows to return.                 :          :         :

--------------------------------------------------------------------------------

