> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinkfish.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# postgresql

> SQL queries and schema management

**Server path:** `/postgresql` | **Type:** Application | **PCID required:** Yes

## Tools

| Tool                                                      | Description                                |
| --------------------------------------------------------- | ------------------------------------------ |
| [`postgresql_execute_query`](#postgresql_execute_query)   | Execute a SQL query on PostgreSQL database |
| [`postgresql_select_data`](#postgresql_select_data)       | Select data from a PostgreSQL table        |
| [`postgresql_insert_data`](#postgresql_insert_data)       | Insert data into a PostgreSQL table        |
| [`postgresql_update_data`](#postgresql_update_data)       | Update data in a PostgreSQL table          |
| [`postgresql_delete_data`](#postgresql_delete_data)       | Delete data from a PostgreSQL table        |
| [`postgresql_describe_table`](#postgresql_describe_table) | Get table structure and column information |
| [`postgresql_list_tables`](#postgresql_list_tables)       | List all tables in the database            |
| [`postgresql_create_table`](#postgresql_create_table)     | Create a new table in PostgreSQL           |

***

## postgresql\_execute\_query

Execute a SQL query on PostgreSQL database

**Parameters:**

| Parameter    | Type      | Required | Default | Description                                |
| ------------ | --------- | -------- | ------- | ------------------------------------------ |
| `query`      | string    | Yes      | —       | SQL query to execute                       |
| `parameters` | string\[] | No       | —       | Query parameters for parameterized queries |

<Expandable title="inputSchema">
  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "PCID": {
        "type": "string",
        "description": "Pink Connect ID"
      },
      "query": {
        "type": "string",
        "description": "SQL query to execute"
      },
      "parameters": {
        "type": "array",
        "items": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": "Query parameters for parameterized queries"
      }
    },
    "required": [
      "PCID",
      "query"
    ]
  }
  ```
</Expandable>

***

## postgresql\_select\_data

Select data from a PostgreSQL table

**Parameters:**

| Parameter     | Type      | Required | Default | Description                         |
| ------------- | --------- | -------- | ------- | ----------------------------------- |
| `table`       | string    | Yes      | —       | Table name                          |
| `columns`     | string\[] | No       | —       | Columns to select (defaults to all) |
| `where`       | string    | No       | —       | WHERE clause conditions             |
| `whereParams` | string\[] | No       | —       | Parameters for WHERE clause         |
| `orderBy`     | string    | No       | —       | ORDER BY clause                     |
| `limit`       | number    | No       | —       | LIMIT number of results             |
| `offset`      | number    | No       | —       | OFFSET for pagination               |

<Expandable title="inputSchema">
  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "PCID": {
        "type": "string",
        "description": "Pink Connect ID"
      },
      "table": {
        "type": "string",
        "description": "Table name"
      },
      "columns": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Columns to select (defaults to all)"
      },
      "where": {
        "type": "string",
        "description": "WHERE clause conditions"
      },
      "whereParams": {
        "type": "array",
        "items": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": "Parameters for WHERE clause"
      },
      "orderBy": {
        "type": "string",
        "description": "ORDER BY clause"
      },
      "limit": {
        "type": "number",
        "description": "LIMIT number of results"
      },
      "offset": {
        "type": "number",
        "description": "OFFSET for pagination"
      }
    },
    "required": [
      "PCID",
      "table"
    ]
  }
  ```
</Expandable>

***

## postgresql\_insert\_data

Insert data into a PostgreSQL table

**Parameters:**

| Parameter | Type   | Required | Default | Description                                                                                   |
| --------- | ------ | -------- | ------- | --------------------------------------------------------------------------------------------- |
| `table`   | string | Yes      | —       | Table name                                                                                    |
| `data`    | object | Yes      | —       | Data to insert as key-value pairs (supports nested objects and arrays for JSON/JSONB columns) |

<Expandable title="inputSchema">
  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "PCID": {
        "type": "string",
        "description": "Pink Connect ID"
      },
      "table": {
        "type": "string",
        "description": "Table name"
      },
      "data": {
        "type": "object",
        "additionalProperties": true,
        "description": "Data to insert as key-value pairs (supports nested objects and arrays for JSON/JSONB columns)"
      }
    },
    "required": [
      "PCID",
      "table",
      "data"
    ]
  }
  ```
</Expandable>

***

## postgresql\_update\_data

Update data in a PostgreSQL table

**Parameters:**

| Parameter     | Type      | Required | Default | Description                                                                                   |
| ------------- | --------- | -------- | ------- | --------------------------------------------------------------------------------------------- |
| `table`       | string    | Yes      | —       | Table name                                                                                    |
| `data`        | object    | Yes      | —       | Data to update as key-value pairs (supports nested objects and arrays for JSON/JSONB columns) |
| `where`       | string    | Yes      | —       | WHERE clause                                                                                  |
| `whereParams` | string\[] | No       | —       | Parameters for WHERE clause                                                                   |

<Expandable title="inputSchema">
  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "PCID": {
        "type": "string",
        "description": "Pink Connect ID"
      },
      "table": {
        "type": "string",
        "description": "Table name"
      },
      "data": {
        "type": "object",
        "additionalProperties": true,
        "description": "Data to update as key-value pairs (supports nested objects and arrays for JSON/JSONB columns)"
      },
      "where": {
        "type": "string",
        "description": "WHERE clause"
      },
      "whereParams": {
        "type": "array",
        "items": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": "Parameters for WHERE clause"
      }
    },
    "required": [
      "PCID",
      "table",
      "data",
      "where"
    ]
  }
  ```
</Expandable>

***

## postgresql\_delete\_data

Delete data from a PostgreSQL table

**Parameters:**

| Parameter     | Type      | Required | Default | Description                             |
| ------------- | --------- | -------- | ------- | --------------------------------------- |
| `table`       | string    | Yes      | —       | Table name                              |
| `where`       | string    | Yes      | —       | WHERE clause to identify rows to delete |
| `whereParams` | string\[] | No       | —       | Parameters for WHERE clause             |

<Expandable title="inputSchema">
  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "PCID": {
        "type": "string",
        "description": "Pink Connect ID"
      },
      "table": {
        "type": "string",
        "description": "Table name"
      },
      "where": {
        "type": "string",
        "description": "WHERE clause to identify rows to delete"
      },
      "whereParams": {
        "type": "array",
        "items": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": "Parameters for WHERE clause"
      }
    },
    "required": [
      "PCID",
      "table",
      "where"
    ]
  }
  ```
</Expandable>

***

## postgresql\_describe\_table

Get table structure and column information

**Parameters:**

| Parameter | Type   | Required | Default | Description            |
| --------- | ------ | -------- | ------- | ---------------------- |
| `table`   | string | Yes      | —       | Table name to describe |

<Expandable title="inputSchema">
  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "PCID": {
        "type": "string",
        "description": "Pink Connect ID"
      },
      "table": {
        "type": "string",
        "description": "Table name to describe"
      }
    },
    "required": [
      "PCID",
      "table"
    ]
  }
  ```
</Expandable>

***

## postgresql\_list\_tables

List all tables in the database

<Expandable title="inputSchema">
  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "PCID": {
        "type": "string",
        "description": "Pink Connect ID"
      }
    },
    "required": [
      "PCID"
    ]
  }
  ```
</Expandable>

***

## postgresql\_create\_table

Create a new table in PostgreSQL

**Parameters:**

| Parameter   | Type      | Required | Default | Description                 |
| ----------- | --------- | -------- | ------- | --------------------------- |
| `tableName` | string    | Yes      | —       | Name of the table to create |
| `columns`   | object\[] | Yes      | —       | Table column definitions    |

<Expandable title="inputSchema">
  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "PCID": {
        "type": "string",
        "description": "Pink Connect ID"
      },
      "tableName": {
        "type": "string",
        "description": "Name of the table to create"
      },
      "columns": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "Column name"
            },
            "type": {
              "type": "string",
              "description": "Column data type (e.g., VARCHAR(255), INTEGER, TEXT)"
            },
            "nullable": {
              "type": "boolean",
              "default": true,
              "description": "Whether column can be NULL"
            },
            "primaryKey": {
              "type": "boolean",
              "default": false,
              "description": "Whether column is primary key"
            },
            "autoIncrement": {
              "type": "boolean",
              "default": false,
              "description": "Whether column auto-increments (uses SERIAL)"
            }
          }
        },
        "description": "Table column definitions"
      }
    },
    "required": [
      "PCID",
      "tableName",
      "columns"
    ]
  }
  ```
</Expandable>
