Workflows
Blocks
Database
PostgreSQL

PostgreSQL Database Block

What it does: Connect your workflow to a PostgreSQL database to read, add, update, or delete data automatically.

🗄️

In simple terms: Like having an assistant who can work with your database for you - finding information, adding new records, making changes, or removing old data whenever your workflow needs it.

When to Use This

Use the PostgreSQL block when you need to:

  • ✅ Look up customer information from your database
  • ✅ Save form submissions to your database
  • ✅ Update order statuses automatically
  • ✅ Remove outdated records
  • ✅ Generate reports from database data
  • ✅ Sync data between systems

Example: When a new order comes in, automatically save it to your database and update the customer's purchase history.

Key Features

  • Read Data: Find and retrieve information from your database
  • Add Data: Insert new records automatically
  • Update Data: Modify existing records based on conditions
  • Delete Data: Remove records when no longer needed
  • Secure Connections: Connect safely with encrypted connections
  • Use Results: Pass database results to other workflow blocks

Setup Guide

Step 1: Add Your Database Connection

You'll need these details from your database administrator:

SettingWhat It IsExample
HostYour database server addressdb.mycompany.com
PortConnection port (usually 5432)5432
DatabaseThe database nameproduction_db
UsernameYour database loginworkflow_user
PasswordYour database password(keep this secure!)
🔒

Security Tip: Always use a dedicated database user with only the permissions needed for your workflow. Never use admin credentials.

Step 2: Choose Your Operation

Read Data (SELECT): Find and retrieve information

  • Choose which table to read from
  • Pick the columns you need
  • Add filters to find specific records
  • Sort results as needed

Add Data (INSERT): Create new records

  • Select the target table
  • Map your workflow data to table columns
  • New records are added automatically

Update Data (UPDATE): Change existing records

  • Choose which records to update using conditions
  • Specify which fields to change
  • Only matching records are modified

Delete Data (DELETE): Remove records

  • Set conditions for which records to remove
  • Only matching records are deleted

Step 3: Map Your Data

Connect workflow variables to database fields:

Workflow VariableMaps ToExample Value
{{form.customerName}}Customer Name columnJohn Smith
{{form.email}}Email columnjohn@email.com
{{order.total}}Order Amount column150.00

Common Use Cases

Save Form Submissions

When someone fills out a form, automatically save their information to your database. The workflow captures form data and inserts it as a new record.

Look Up Customer Information

When processing an order, look up the customer's details, preferences, and order history to personalize the experience.

Update Order Status

When an order ships, automatically update the order status in your database from "Processing" to "Shipped" along with the tracking number.

Generate Reports

Pull data from your database for specified date ranges or criteria, then use it to create automated reports.

Sync Between Systems

Read data from one source and update your PostgreSQL database to keep systems in sync.

What You Get Back

After the block runs, you receive:

  • Success/Failure Status: Whether the operation completed successfully
  • Row Count: How many records were affected
  • Data Rows: The actual data (for read operations)
  • Error Details: What went wrong (if anything)

Tips for Success

  1. Test with a small dataset first before running on all your data
  2. Always use filters when updating or deleting to avoid accidents
  3. Check your results to make sure you got what you expected
  4. Use descriptive names for your database columns to make mapping easier

Troubleshooting

ProblemLikely CauseSolution
Can't connectWrong credentials or firewall blockingDouble-check host, port, username, password
No data returnedFilter too strict or table emptyAdjust your conditions or check the table
Permission deniedUser lacks access to tableAsk your admin to grant permissions
Data not savingRequired field missingMake sure all required columns have values

Best Practices

  • Use SSL connections for production databases to keep data secure in transit
  • Create a dedicated user for your workflows with limited permissions
  • Log your operations to track what your workflow does to the database
  • Handle errors gracefully by adding condition blocks to check for failures
Indite Documentation v1.4.0
PrivacyTermsSupport