I need some advice where I’m heading wrong.
So the scenario is that I’m inserting a JSON object into a Postgresql table (to a JSONB column) for warehousing purposes. When I run the query manually on the database everything works as expected but on the n8n Postgres node it fails with a syntax error due to the Postgres node adding a unexpected [object Object] reference.
The issue can be replicated by using the query that’s visible in the first screen shot below (note the [object Object] in values).
INSERT INTO payment_data (record_id, doc_id, json_data)
VALUES (3, 319, [object Object]);
The expected result from the Postgres node expression is:
INSERT INTO payment_data (record_id, doc_id, json_data)
VALUES (1, 319, '{"key":"value"}');
What is the way to omit the [Object] reference to get the query working? I should note that [Object] is placed by JSON > data > raw value selection.