HostWebhook Help Center

Stop a Postgres trigger from firing on its own flow

Ignore changes made by this flow: a flow that writes back to the table it watches runs once, not on every check. What it covers and when it cannot help.

Time about 5 minutesYou need a HostWebhook account and a Postgres databaseUpdated November 3, 2026

A flow that writes back to the table its Postgres trigger watches can start itself again. It marks the row that fired it as done, or adds an audit row, and the next check sees that change like any other. With Updated rows and an updated_at that your database moves on every edit, the flow fires itself on every check. Ignore changes made by this flow stops that, and it's on by default.

New to the Postgres trigger? Setting it up (the connection, the table, what fires it and the cursor) is in the Postgres setup docs. This guide is only about the switch.

Find the switch in the Postgres trigger

In Flows, open the Postgres trigger node. Ignore changes made by this flow is in its configuration, below the table, what fires it and the cursor. It's on unless someone turned it off.

  1. Marker 1: The table the trigger watches.
  2. Marker 2: What fires it, here Updated rows, with an updated_at column as the cursor.
  3. Marker 3: Ignore changes made by this flow, marked on by default. Its line says what it does: rows this flow's Postgres nodes change don't fire it, for example its own UPDATE orders SET status = 'done'. Same connection only.
Postgres trigger configuration with a table picked, Updated rows, the cursor column and the Ignore changes made by this flow switch on

Rows that people edit, and rows other flows write, still fire it: only this flow's own writes are skipped.

Write back to the same table

Add a Postgres node after the trigger and use the same Postgres credential as the trigger. Write the SQL that changes the row that fired the flow, for example:

SQL
UPDATE orders SET status = 'done' WHERE id = {{payload.row.id}}

{{payload.row.id}} is the id column of the row that fired the trigger. The Postgres node sends it as a parameter, never as SQL text.

  1. Marker 1: Its input is the Postgres trigger: the row that fired the flow comes in here.
  2. Marker 2: Its connection, which has to be the same Postgres credential the trigger uses.
The Postgres node after the trigger, with the trigger as its input and its Postgres connection

Further down the same node is its SQL:

  1. Marker 1: The same input: the row from the trigger.
  2. Marker 2: Its SQL changes the row that fired the flow, with {{payload.row.id}} in the WHERE.
The SQL of the Postgres node: an UPDATE on the trigger's table, with payload.row.id in the WHERE

It only knows writes through the same connection.

The switch covers everything the flow writes with a Postgres node that uses the trigger's credential: one statement, transaction mode and the AI node tools that insert, update or delete. A node with another credential isn't recognised, even if it points at the same database, so its writes fire the trigger again.

Check that it fired once

Turn the flow on and edit one row in orders the way your app does, so its updated_at moves. The flow runs once and marks the row as done. At the next check, the trigger skips that change and doesn't start the flow again: there's one run for your edit, and none for the flow's own UPDATE.

  1. Marker 1: How many of this flow's own changes the trigger skipped since Activate, here 1 change made by this flow ignored since Activate.
  2. Marker 2: What it fired on: your edit (operation: updated), sent to the Postgres node. The flow's own UPDATE doesn't show up as an event.
The Postgres trigger after a few checks: the line that counts the changes made by this flow that were ignored, and the output with the change that fired it
How it knows a change was made by this flow

When a run was started by this trigger, the Postgres node of that flow runs its SQL inside a transaction. Just before it commits, it notes that transaction's id. The id is a number; nothing from your rows is kept. At the next check, the trigger also asks Postgres who last wrote each row (the xmin column) and skips the rows this flow's transactions wrote. The cursor moves on as usual. A note is kept 24 to 49 hours. If a note can't be saved, the SQL still commits, the node's output says so in _ownWritesNote, and the trigger may fire on that change.

When it can't help

It needs a table. A view can't tell who wrote a row, so when you pick one the switch is off and can't be turned on.

  1. Marker 1: A view is picked instead of a table: the picker marks it view.
  2. Marker 2: The switch is off and marked needs a table. Its line says: Off here: a view, foreign or materialized table can't tell who wrote a row. Watch the table itself.
Postgres trigger with a view picked: the switch is off, marked needs a table, with the line that says to watch the table itself

It also can't recognise the writes in these cases:

  • SQL that ends the transaction itself, with its own COMMIT or ROLLBACK, isn't noted for what it wrote before that point.
  • SQL that can't run in a transaction, such as VACUUM or CREATE INDEX CONCURRENTLY, runs as always and isn't noted. The same goes for any SQL on Postgres older than 10.
  • A copy of the database has its own ids, so watch the same server the flow writes to. A physical replica keeps them, but a logical one doesn't.
  • A database trigger that updates rows later from another session, such as dblink or a worker that listens for NOTIFY, fires the trigger once more.

In the first two cases, the Postgres node's output says so in _ownWritesNote.

Turn it off on purpose (optional)

Optional

Turn the switch off only if you want the flow to start itself with its own writes, for example a flow that keeps itself going on purpose. The line under the switch then reads: This flow's own changes fire it too: a flow that updates the row that fired it loops on every check.

Two flows can still feed each other.

The switch only skips the writes of its own flow. If two flows write to each other's tables, give one of them a condition to stop on, such as a Filter node on the status it sets.

Troubleshooting

The flow still starts itself. Check that the Postgres node uses the same credential as the trigger, and that the switch is on. Then open the node's last output: if it has _ownWritesNote, the note says why that write wasn't recognised.

A change someone made didn't start the flow. The trigger only sees the last version of a row. If a person edits a row and the flow writes the same row again before the next check, the version it sees is the flow's, and it's skipped.

The trigger says it can't work on a view, a foreign table or a materialized view. Watch the table itself. Otherwise this trigger may fire on rows the flow writes.