Node does not return "enough items"

Hey everyone,

I have the following problem & one question.

Problem

I have an HTTP request and a split. The split node correctly splits the HTTP into 10 items. But the Postgres only returns 1 item. No matter what, which settings I chose. Any suggestions?

Screenshot 2024-08-14 at 14.02.34

Question - Best practice

What is the best practice for receiving the data from a split item? Using $runindex or simply using $(‘split’).XYZ??

Please share your workflow

{
  "meta": {
    "instanceId": "7ecc4c1f652016838e47da85b0b5abb902e7324953484497120ca7411c71bfa4"
  },
  "nodes": [
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "756c1dfd-ea98-4718-ba89-e366f412375d",
              "leftValue": "={{!!($json.profile_data)}}",
              "rightValue": "true",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {
          "looseTypeValidation": false
        }
      },
      "id": "26db6b85-2dc5-42c0-80b6-b1314617581e",
      "name": "Profile already scraped?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        2600,
        620
      ],
      "alwaysOutputData": false,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "fieldToSplitOut": "data",
        "options": {
          "destinationFieldName": "commenter"
        }
      },
      "id": "a38de921-dc02-42d4-8173-1eefaac6c18a",
      "name": "Split Commenters",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        2100,
        620
      ]
    },
    {
      "parameters": {
        "operation": "select",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "profiles",
          "mode": "list",
          "cachedResultName": "profiles"
        },
        "returnAll": "",
        "where": {
          "values": [
            {
              "column": "urn",
              "value": "={{ $('Split Commenters').item.json.commenter.author.urn }}"
            }
          ]
        },
        "options": {}
      },
      "id": "63c4b0bb-86d6-46f4-98cd-a2c98d0f6c57",
      "name": "Find Profile",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        2300,
        620
      ],
      "alwaysOutputData": false,
      "credentials": {
        "postgres": {
          "id": "KDSYnk7MvyWxjqAf",
          "name": "Postgres account"
        }
      }
    }
  ],
  "connections": {
    "Split Commenters": {
      "main": [
        [
          {
            "node": "Find Profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Profile": {
      "main": [
        [
          {
            "node": "Profile already scraped?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {}
}```

->

## Information on your n8n setup
- **n8n version: latest beta
- **Database (default: SQLite): default
- **n8n EXECUTIONS_PROCESS setting (default: own, main):** cloud
-**Running n8n via (Docker, npm, n8n cloud, desktop app): cloud
- **Operating system: -

Ah, can it be that batching makes Postgres output only one item and I have to split again??

Sometimes I am confused when split is necessary and when not…

Ok that’s not the result I expected :smiley:

Ok, it seems like Postgres is one of the nodes that only executes once and needs a loop.

If someone can confirm this, that would be nice :slight_smile:

Hi @Noro

Yes I can confirm the postgres node only executes once.
So a manual loop is indeed needed.

2 Likes

@BramKn thanks so much… I started to think I am crazy :wink:

1 Like

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