Insert error on postgres database

Hi,

I have this error during insert data in my postgres database :

error: syntax error at or near ")"
    at Parser.parseErrorMessage (/usr/local/lib/node_modules/n8n/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/usr/local/lib/node_modules/n8n/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/usr/local/lib/node_modules/n8n/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

my postgres node :

    {
      "parameters": {
        "operation": "executeQuery",
        "query": "=INSERT INTO main.coinmarket  VALUES ({{$node[\"Function\"].json[\"id\"]}}, '{{$node[\"Function\"].json[\"name\"]}}','{{$node[\"Function\"].json[\"symbol\"]}}',{{$node[\"Function\"].json[\"cmc_rank\"]}},{{$node[\"Function\"].json[\"price\"]}},{{$node[\"Function\"].json[\"circulating_supply\"]}},{{$node[\"Function\"].json[\"volume_24h\"]}},{{$node[\"Function\"].json[\"percent_change_1h\"]}},{{$node[\"Function\"].json[\"percent_change_24h\"]}},{{$node[\"Function\"].json[\"percent_change_7d\"]}},{{$node[\"Function\"].json[\"market_cap\"]}},'{{$node[\"Function\"].json[\"last_updated\"]}}'::timestamp, {{$node[\"Function\"].json[\"max_supply\"]}}) ON CONFLICT (id) DO NOTHING",
        "additionalFields": {}
      },
      "name": "Postgres",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 1,
      "position": [
        990,
        280
      ],
      "credentials": {
        "postgres": "DB"
      }
    },

You have to share the whole workflow. A single node cannot be paste in the workflow editor.

I found the solution, i had an empty value in my last insert parameter.

1 Like

Thanks for sharing the solution with the community.