Skip to content

My workflow 13

A simple database query workflow that connects to a PostgreSQL database and retrieves data from a selected table. This workflow provides a basic foundation for database operations and can be manually triggered to fetch records on demand.

Purpose

No business context provided yet — add a context.md to enrich this documentation.

How It Works

  1. Manual Trigger: The workflow starts when a user manually clicks the "Execute workflow" button
  2. Database Query: Connects to a PostgreSQL database and executes a SELECT operation on a specified table in the public schema
  3. Data Retrieval: Returns all rows from the selected table for further processing or review

Workflow Diagram

graph TD
    A["When clicking 'Execute workflow'<br/>(Manual Trigger)"] --> B["Select rows from a table<br/>(PostgreSQL)"]

Trigger

  • Type: Manual Trigger
  • Activation: User must manually click "Execute workflow" button
  • Frequency: On-demand only

Nodes Used

Node Type Node Name Purpose
Manual Trigger When clicking 'Execute workflow' Initiates the workflow when manually executed
PostgreSQL Select rows from a table Connects to PostgreSQL database and retrieves data from a specified table

External Services & Credentials Required

PostgreSQL Database

  • Service: PostgreSQL database server
  • Required Credentials:
    • Database host/connection string
    • Database name
    • Username and password
    • Port (typically 5432)
  • Permissions Needed: SELECT permissions on the target table(s)

Environment Variables

No specific environment variables are configured in this workflow. Database connection details are managed through n8n's credential system.

Data Flow

Input

  • No external input data required
  • Database connection parameters configured in the PostgreSQL node

Output

  • Format: Array of objects
  • Content: All rows from the selected database table
  • Structure: Each row returned as a JSON object with column names as keys

Data Transformation

  • Raw database rows are automatically converted to JSON format
  • Column names become object properties
  • Data types are preserved based on PostgreSQL field types

Error Handling

This workflow does not implement explicit error handling. Potential failure points include: - Database connection issues - Invalid table selection - Insufficient database permissions - Network connectivity problems

Errors will cause the workflow to fail and stop execution.

Known Limitations

  • No business context provided to identify specific limitations
  • Table selection appears to be empty in the current configuration
  • No data filtering or pagination implemented
  • Manual trigger only - no automated scheduling

No related workflows identified from the provided context.

Setup Instructions

1. Import Workflow

  1. Copy the workflow JSON
  2. In n8n, go to Workflows → Import from JSON
  3. Paste the JSON and save

2. Configure PostgreSQL Connection

  1. Click on the "Select rows from a table" node
  2. Create or select PostgreSQL credentials:
    • Host: Your PostgreSQL server address
    • Database: Target database name
    • User: Database username
    • Password: Database password
    • Port: Database port (default: 5432)

3. Configure Table Selection

  1. In the PostgreSQL node, set the Schema to "public" (or your target schema)
  2. Select the specific table you want to query from the dropdown
  3. Optionally configure additional query parameters

4. Test the Workflow

  1. Save the workflow
  2. Click "Execute workflow" to test the connection
  3. Verify that data is returned from your selected table

5. Activate (Optional)

  • This workflow uses manual trigger, so activation is not required
  • You can activate it if you plan to add scheduled triggers later