Postgres node - no value output

Hello all,
I have a question about the Postgres node. I want to make a workflow where I ask to a postgres database to return the value of 2 columns. Something like SELECT 1,2 WHERE 3=“something”.

The problem is when if one of the executions does’t exist in the database and i want to correlate the first execution to the first output of the database. So, if I have 20 executions and something is not in the DB the postgres will only return like 18, for example.

Is there any change that we output empty values in the execution if the value doest exist in the postgres DB?

Information on your n8n setup

  • **n8n version:0.201

Hi @Tiago_Cardoso, this is the expected behaviour I am afraid. n8n will run your query for each item it receives but only returns the items it finds.

What you could do is use the SplitInBatches node before your Postgres node to split the execution into batches of 1, then enable the Always Output Data setting of your Postgres node:


This way, the node would return an empty item if your query doesn’t return any data.

1 Like

Thanks :slight_smile:

1 Like