Hello!
PostgreSQL supports INSERT INTO… RETURNING * statements but DB Query Reader doesn’t.
The preview show an error but execution works and ID (alternate_loading_id) is correct but something is wrong with transaction because the new row is not visible in the table (transaction was rollbacked?)
Thank you for contacting KNIME regarding this issue.
My understanding of the issue is that the DB Query Reader node is failing to properly parse valid postgresql INSERT INTO…RETURNING statements.
I have verified this behavior in AP 4.2.1; however, please confirm what version(s) of KNIME Analytics Platform (AP) you have experienced this issue on just for comparison.
At this time, I have created a defect/query designated AP-15183 for tracking; if there are any updates on this issue, I will communicate them to you further on this forum thread.
Hello,
executing the statement using the DB Query Reader works. However pressing the Evaluate button in the node dialog won’t work since KNIME surrounds your statement with a limit statement as shown in the left part of the preview window. This is done to prevent fetching of all values just for evaluation but unfortunately fails for these kind of special statements that can not be wrapped within a limit statement. So executing the node should work.
Bye
Tobias
Hello,
sorry, I have forgotten that the changes will not be committed automatically. To solve this problem you can surround the DB Query Reader node with the DB Transaction Start and DB Transaction End node. The DB Transaction End node will commit all changes. You can find an example workflow in the KNIME Hub.
You need to add flow variable connection between the transaction ends and the cross joiners, connect both to a Merge Variables and than the Merge Variables to the Cross Joiner