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, go to Application Management on your sidebar.

  2. Scroll through your applications until you find PostgreSQL.

  3. Click on Configure. This screen with your Application Details will appear:


Step 2: Open n8n

  1. Open n8n in you Dashboard and create a workflow.

  1. Add a PostgreSQL node to your workflow.


Step 3: Configure PostgreSQL Credentials

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

  1. Click underneath Credential and select Create new credential.

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

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


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 and click on Download JSON in the column of Chat With Your Database.

  1. Copy the URL of the page that opens up.

  2. Open n8n in you Dashboard and create a workflow. Click on the three dots in the right corner of your screen and then on Import from URL....

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

  1. The following workflow will show on your screen:

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

Last updated

Was this helpful?