> For the complete documentation index, see [llms.txt](https://docs.glbnxt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.glbnxt.com/tutorials/guides/connecting-postgresql-n8n.md).

# Setting up PostgreSQL in n8n

This guide walks you connecting Postgres to your n8n workflows as a database.

***

### Prerequisites

* Access to your n8n instance.
* Access to PostgreSQL with admin or tool management permissions (superuser).

***

### Step 1: Find PostgreSQL Credentials

1. On the [GLBNXT Platform](https://platform.glbnxt.com/), go to [Application Management](https://platform.glbnxt.com/applications) on your sidebar.
2. Scroll through your applications until you find **PostgreSQL**.
3. Click on `Configure`. This screen with your **Application Details** will appear:

<img src="/files/69tYHifPSisPtAhNHYmx" alt="" width="200">

***

### Step 2: Open n8n

1. Open n8n in you [Dashboard](https://platform.glbnxt.com/) and create a workflow.

<img src="/files/GtpOGk9mObgKpbTJzZuj" alt="" width="200">

2. Add a **PostgreSQL** node to your workflow.

<img src="/files/aDyLx39pg1z9frjvwjp7" alt="" width="200">

***

### Step 3: Configure PostgreSQL Credentials

1. Double-click the first **PostgreSQL** node (`Create a Table`)

<img src="/files/AdhxsvYTZN7ZmTRYnr0x" alt="" width="200">

2. Click underneath `Credential` and select `Create new credential`.

<img src="/files/eQYBrIkTNZYXj6b2VGqt" alt="" width="200">

3. Enter the credentials found in **Step 2**. Your pop-up screen should look like this:

<img src="/files/z9ZFouUPvvyv1tTMttPy" alt="" width="200">

4. Click on `Save`, your see the below shown notification and are now able to work with PostgreSQL in n8n.

<img src="/files/Zc1lQUafzbPPvykQF8aV" alt="" width="500">

***

### Step 4: Use PostgreSQL in the Use Cases

Now you know how to add your credentials, try PostgreSQL out for yourself.

1. Open the [Use Cases Page](https://platform.glbnxt.com/sandbox) and click on `Download JSON` in the column of **Chat With Your Database**.

<img src="/files/vDDsMzDdrpCmaLKZhXLb" alt="" width="200">

2. Copy the URL of the page that opens up.
3. Open n8n in you [Dashboard](https://platform.glbnxt.com/) and create a workflow. Click on the three dots in the right corner of your screen and then on `Import from URL...`.

<img src="/files/GtpOGk9mObgKpbTJzZuj" alt="" width="200">

3. Enter the URL in the pop-up that appears.

<img src="/files/nwqBLxE3nd56z5gemJdS" alt="" width="200">

4. The following workflow will show on your screen:

<img src="/files/5MpLcUaiPnOELTfnQHue" alt="" width="200">

4. Click on `Open chat` and type a message. To give you some inspiration we have some ready-to-use prompts:
   * *"Hey! Can you list all the tables available in my database right now and tell me briefly what they seem to be for?"*
     * You will see the **AI Agent1** node activate, fire off a background connection to your Postgres node using your credentials, and read the catalog tables to give you a list.
   * *"I see we have a table called \[insert your table name here]. Can you inspect it and tell me exactly what columns, types, and primary keys it uses?"*
     * The agent will inspect the columns and summarize the structure for you.
   * *"Give me a breakdown of how many records were created on each day of the week, sorted from highest to lowest."*
     * The agent will write a raw SQL query and then hands it to the **Execute a SQL query in Postgres** tool to run against your database.

***

### Troubleshooting

* If your `Host` name looks like this: your-host-name:1234, then the numeric combination after : is your `Port`. To successfully connect your credentials, enter your-host-name for `Host` and 1234 for `Port`.

***

*Need help? Contact the GLBNXT support team or ask a GLBNXT agent to walk you through the setup.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.glbnxt.com/tutorials/guides/connecting-postgresql-n8n.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
