Postgres - Error when select rows comparing timestamp field

Describe the problem/error/question

I’m trying to get the newest records from a Postgres table, getting only the ones greater or equal to a specific date.

Using the Postgres Node with Operation=Select, the node gives an error.

Using the Postgres Node with Operation=Execute Query, the node works ok. In this case, the query is:

SELECT * FROM urls WHERE added >= $1

In both cases, the comparing date is:

{{ new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString() }}

This seems to be the similar problem that the question Postgres node and postgres trigger node from 2023, but it seems to be not resolved.

What is the error message (if any)?

Operator in entry 1 of ‘Select Rows’ works with numbers, but value 2025-11-18T10:08:40.673Z is not a number [item 0]

Please share your workflow

{
“nodes”: [
{
“parameters”: {},
“type”: “n8n-nodes-base.noOp”,
“typeVersion”: 1,
“position”: [
-16,
240
],
“id”: “fbd1d55e-896a-47f0-8b4e-12c3e939f336”,
“name”: “after_loop”
},
{
“parameters”: {
“operation”: “select”,
“schema”: {
“__rl”: true,
“value”: “public”,
“mode”: “list”,
“cachedResultName”: “public”
},
“table”: {
“__rl”: true,
“value”: “urls”,
“mode”: “list”,
“cachedResultName”: “urls”
},
“where”: {
“values”: [
{
“column”: “added”,
“condition”: “>=”,
“value”: “={{ new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString() }}”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.postgres”,
“typeVersion”: 2.6,
“position”: [
224,
144
],
“id”: “ec1a98ff-1384-443e-91ce-1ae0d73ef1df”,
“name”: “Select rows from a table”,
“alwaysOutputData”: true,
“credentials”: {
“postgres”: {
“id”: “ibj2411N8FoIh62h”,
“name”: “OCI-Postgres”
}
}
},
{
“parameters”: {
“operation”: “executeQuery”,
“query”: “SELECT * FROM urls WHERE added >= $1”,
“options”: {
“queryReplacement”: “={{ new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString() }}”
}
},
“type”: “n8n-nodes-base.postgres”,
“typeVersion”: 2.6,
“position”: [
224,
336
],
“id”: “3f847627-4cf5-49b9-a0fa-4a78529139b6”,
“name”: “Execute a SQL query”,
“executeOnce”: true,
“credentials”: {
“postgres”: {
“id”: “ibj2411N8FoIh62h”,
“name”: “OCI-Postgres”
}
}
}
],
“connections”: {
“after_loop”: {
“main”: [
[
{
“node”: “Execute a SQL query”,
“type”: “main”,
“index”: 0
},
{
“node”: “Select rows from a table”,
“type”: “main”,
“index”: 0
}
]
]
},
“Select rows from a table”: {
“main”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “f9acd581ca6add88de8c62a6233e7ca5dd61188c9979395ef8f5a22ec755c644”
}
}

Share the output returned by the last node

{
“errorMessage”: “Operator in entry 1 of ‘Select Rows’ works with numbers, but value 2025-11-18T10:08:40.673Z is not a number [item 0]”,
“errorDetails”: {},
“n8nDetails”: {
“nodeName”: “Select rows from a table”,
“nodeType”: “n8n-nodes-base.postgres”,
“nodeVersion”: 2.6,
“resource”: “database”,
“operation”: “select”,
“itemIndex”: 0,
“time”: “11/28/2025, 11:08:40 AM”,
“n8nVersion”: “1.120.4 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“NodeOperationError: Operator in entry 1 of ‘Select Rows’ works with numbers, but value 2025-11-18T10:08:40.673Z is not a number”,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/Postgres/v2/helpers/utils.ts:160:11",
" at Array.forEach ()“,
" at addWhereClauses (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/Postgres/v2/helpers/utils.ts:152:10)”,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/Postgres/v2/actions/database/select.operation.ts:112:36)“,
" at ExecuteContext.router (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/Postgres/v2/actions/router.ts:41:68)”,
" at processTicksAndRejections (node:internal/process/task_queues:105:5)“,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/Postgres/v2/PostgresV2.node.ts:26:10)”,
" at WorkflowExecute.executeNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1093:8)“,
" at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1274:11)”,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1708:27"
]
}
}

Information on your n8n setup

  • n8n version: 1.120.4
  • Database (default: SQLite): Postgres SQL 17
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system:

Yes, this option is more flexible, since you can do some selections based of a SQL query :

WHERE added >= NOW() - INTERVAL ‘1 day’

or complex query with DESC, LIMIT .

Cheers!

Yes, the SQL query is more flexible, but I only want to get all rows where a value in a column is equal to greater than a set value (fixed or expression).

This can be configured in the Postgres node with the Select option, but it doesn’t work.

I’m not looking for an alternative solution. I’m pointing to a bug in the Postgres node to be fixed. And this bug is there from 2023. Maybe is time to fix it.

Any update about this bug?