Bug in the postgres node with manual mapping

Describe the problem/error/question

When creating a row in the Postgres table via the Postgres node, if, for example, the id column has the primary property, then it is impossible to create a row with manual mapping.

This is due to the fact that the table automatically numbers the id column, respectively, with manual mapping, you do not need to transfer data to the id, and n8n forcibly asks you to fill in the data.

What is the error message (if any)?

Issues:

  • Column “id” is required

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.69.2
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own, main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 22.04

If you copy and paste the node into notepad, then remove the obligation of the id field and move the node back into the process, then n8n allows you to delete the id field, after which the entry in the database goes well.

image

I don’t think this is a good solution, I think it should be possible to delete a field with the primary property during manual mapping.

1 Like

Hi @Danilov_Vovka

How does your table automatically serialize the id column?
I just tested (on newest node version 2.5) and it does recognize when a column is not required for the insert statement.

See in my screenshot, the id column is not required because my primary key has a default value defined by the nextval() expression.

I’m not OP, but I have the same problem, in 1.71.3 (and earlier)

This is the ID column, using postgres identity column, not nextval.

id bigint GENERATED BY DEFAULT AS IDENTITY NOT NULL

I reported issue at Github:

1 Like

Thanks @thomlov ! That makes sense :slight_smile:

We’ve got an internal ticket for this and will be tracking the updates here as well.
:pray:

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