Using Agent in n8n to Clean Non-Numeric Values in Postgres

Hi Community :waving_hand:,

I’m trying to build an agent-based workflow in n8n that works with my Postgres database.
Here’s my goal:

  • Work inside a specific database and table.

  • Fetch all rows.

  • Analyse one specific column.

  • If any value in that column is non-numeric, update it to 0.

  • Finally, validate that all values are numeric after the update.

I see that the Postgres nodes allow:

  • Select rows from Postgres in a table

  • Insert_or_update_rows_in_a_table_in_Postgres

But I’m not sure how to best structure the agent prompt/workflow so that the agent:

  1. Selects all rows,

  2. Checks for non-numeric values in the chosen column,

  3. Applies updates using the insert/update node,

  4. Validates again at the end.

Has anyone implemented something similar with n8n Agents + Postgres?
Any guidance, examples, or best practices would be super helpful :folded_hands:

Thanks in advance!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.