Part of my workflow is selecting data from one PG instance, end inserting in another. One of the fields is a timestamp.
When I execute this SQL on the second node: INSERT INTO waybill_log (waybill_id,status,date_updated,waybill_status_id) VALUES({{$node["Import WAYBILL LOGS"].json["id"]}},$${{$node["Import WAYBILL LOGS"].json["internal_description"]}}$$,$${{$node["Import WAYBILL LOGS"].json["updated"]}}$$,(SELECT id FROM waybill_status WHERE status = $${{$node["Import WAYBILL LOGS"].json["internal_description"]}}$$ LIMIT 1)) RETURNING *;
I get the following error:
“invalid input syntax for type date: "Mon Jul 06 2020 15:14:05 GMT+0000 (Coordinated Universal Time)”
The problem is probably that the data is an actual JavaScript-Date-Object. You can try to change your query like this:
INSERT INTO waybill_log (waybill_id,status,date_updated,waybill_status_id) VALUES({{$node["Import WAYBILL LOGS"].json["id"]}},$${{$node["Import WAYBILL LOGS"].json["internal_description"]}}$$,$${{$node["Import WAYBILL `LOGS"].`json["updated"].toISOString()}}$$,(SELECT id FROM waybill_status WHERE status = $${{$node["Import WAYBILL LOGS"].json["internal_description"]}}$$ LIMIT 1)) RETURNING *;
So what I changed is that I added .toISOString() to the date.