Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres node validation fails with 0 #11939

Open
ShawnSack opened this issue Nov 28, 2024 · 2 comments · May be fixed by #12382
Open

Postgres node validation fails with 0 #11939

ShawnSack opened this issue Nov 28, 2024 · 2 comments · May be fixed by #12382
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@ShawnSack
Copy link

Bug Description

I am inserting rows into my database. I have a field with a DECIMAL type and a constraint:

retail_price_per_unit DECIMAL(10,2) NOT NULL
        CONSTRAINT positive_retail_price CHECK (retail_price_per_unit >= 0),

However, when I insert a row where the retail_price_per_unit = 0 I get the following error:

{
  "errorMessage": "Invalid input for 'retail_price_per_unit' [item 3]",
  "errorDescription": "The value \"retail_price_per_unit\" is required but not set",
  "errorDetails": {},
  "n8nDetails": {
    "itemIndex": 3,
    "runIndex": 0,
    "time": "11/27/2024, 5:23:27 PM",
    "n8nVersion": "1.68.0 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "ExpressionError: Invalid input for 'retail_price_per_unit' [item 3]",
      "    at validateValueAgainstSchema (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1559:15)",
      "    at getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1681:57)",
      "    at Object.getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:2327:24)",
      "    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Postgres/v2/actions/database/insert.operation.js:172:29)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at Object.router (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Postgres/v2/actions/router.js:50:30)",
      "    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Postgres/v2/PostgresV2.node.js:16:16)",
      "    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:722:19)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:704:51",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1134:20"
    ]
  }
}

My value for item 3:
image

To Reproduce

Create table:

CREATE TABLE dummy_table (
  id TEXT PRIMARY KEY,
  retail_price_per_unit DECIMAL(10,2) NOT NULL
        CONSTRAINT positive_retail_price CHECK (retail_price_per_unit >= 0)
);

Create postgres node and attempt to write 0 to retail_price_per_unit.

Expected behavior

0 is a valid input

Operating System

Ubuntu 22.04

n8n Version

1.68.0

Node.js Version

20

Database

PostgreSQL

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Nov 28, 2024

Hey @ShawnSack,

We have created an internal ticket to look into this which we will be tracking as "GHC-517"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Nov 28, 2024
@dana-gill
Copy link
Contributor

Hey @ShawnSack, we discovered that you can still insert 0 using the executeQuery. While we are still working on this bug, perhaps you can try using the executeQuery Postgres node to get your workflow working :)

@dana-gill dana-gill linked a pull request Dec 27, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants