Templates / Generate and insert data into a Postgres database

Generate and insert data into a Postgres database

Needs changes

by tanaypant ✓ · 6,932 views · created 2020-05-05 · Engineering

Needs changes. This template uses 2 thing(s) that n8n 3.0 removes: Cron, Function (legacy). 2 breaking item(s) found. Static check, last run 2026-10-19.

What to replace before upgrading

Removed in 3.0Replace with
Cron
Cron
Schedule Trigger
Function (legacy)
Function
Code node, mode 'Run Once for All Items'

Nodes used (3)

Postgres

What it does

This is Workflow 1 in the blog tutorial Database activity monitoring and alerting. Prerequisites - A Postgres database set up and credentials. - Basic knowledge of JavaScript and SQL. Nodes - Cron node starts the workflow every minute. - Function node generates sensor data (sensor id (preset), a randomly generated value, timestamp, and notification (preset as false) ) - Postgres node inserts the data into a Postgres database. You can create the database for this workflow with the following SQL statement: SQL CREATE TABLE n8n (id SERIAL, sensorid VARCHAR, value INT, timestamp TIMESTAMP, notification BOOLEAN);

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.