Describe the issue/error/question
I get a syntax error on postgres node when trying to run the following sql query :
with insert_to_entity_list as (
insert into staging_new_3.inventory_entity_list(code,status,created_at,updated_at)
values ('{{$json["code"]}}','{{$json["status"]}}','{{$json["created_at"]}}','{{$json["updated_at"]}}')
returning code, id as entity_id
), insert_to_product as ( insert into staging_new_3.inventory_product(sellmore,entity_id, brand_id, warehouse_id, name, status, ean, hsn, description, cancellation, tax_percentage, created_at, updated_at, mrp, edited_at, hide_on_app, key_features, guarantee_offered, serviceable_by, hot_deal, seller_id, product_details, purchase_price,"brandPrice") values({{$json["sellmore"]}},(select entity_id from insert_to_entity_list),{{$json["brand_id"]}},{{$json["warehouse_id"]}},'{{$json["name"]}}','{{$json["status"]}}','{{$json["ean"]}}','{{$json["hsn"]}}','{{$json["description"]}}','{{$json["cancellation"]}}',{{$json["tax_percentage"]}},'{{$json["created_at"]}}','{{$json["updated_at"]}}',{{$json["mrp"]}},'{{$json["edited_at"]}}',{{$json["hide_on_app"]}},'{{$json["key_features"]}}','{{$json["guarantee_offered"]}}','{{$json["serviceable_by"]}}',{{$json["hot_deal"]}},{{$json["seller_id"]}},'{{$json["product_details"]}}',{{$json["purchase_price"]}},{{$json["mrp"]}}) returning id as product_id ), link_product_category as ( insert into staging_new_3.inventory_product_category(entity_id, product_id, category_id) values((select entity_id from insert_to_entity_list),(select product_id from insert_to_product), {{$json["category_id"]}}) )
select code from insert_to_entity_list;
What is the error message (if any)?
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 (node:events:526:28)
at Socket.emit (node:domain:475:12)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
Can anyone please help me out here.
P.S : The result query comes on the bottom works well in dbeaver