Merge Node when one input is empty

Describe the problem/error/question

I am trying to use the append mode on the merge node. I have data from two different postgres queries and using the merge append node to treat them as one list for the rest of the flow. The problem is that it is not certain that both queries will produce data all the time, maybe query 1 has data, maybe query 2 has data or maybe both. The problem I am facing is that the node wont produce an output if one of the queries returns no records. If I configure the node to produce an output even if there are no records, an [undefined] record is added to the top or end of the list that breaks the split node that follows.

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 8n8n cloud version 1.11.2
  • Database (default: SQLite): Postgres

Hi @gariva :wave:

The Merge node would not run if it doesn’t receive an item on input 1, I’m afraid. It sounds like you’ve turned on the option for “Always output data” as well, from your message, and this would be the workaround to have the Merge node always run :see_no_evil:

You could perhaps try placing an IF node after your Merge node to keep only the items you’re interested in, thus filtering out the empty item that you’re seeing :+1:


Thanks, I tried the if…it works fine.

1 Like

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