Postgres Node causing issues

Hi,

I'm seeing a very strange issue while using "node-red-contrib-postgres-variable". For some reason when I use this node I can't set a flow constant in one branch and get the flow constant in a different branch. I can get it in the same branch. If i remove the "node-red-contrib-postgres-variable" node it works fine. Has anyone else seen this are am I doing something really stupid?

When using the node I also see more errors in the flow. Like timeout errors.

Thanks

Flow is below

[{"id":"b5423d16.2f2fe","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"36483a44.8b46a6","type":"inject","z":"b5423d16.2f2fe","name":"inject1","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":111,"y":190,"wires":[["b3370a35.5fec48"]]},{"id":"27f185b9.9f29ca","type":"function","z":"b5423d16.2f2fe","name":"StoreConfig","func":"//flow.set('config', msg.payload);\nflow.set('config', 'test');\nvar config = flow.get('config');\nmsg.payload = config;\nreturn msg;\n","outputs":1,"noerr":0,"x":749,"y":192,"wires":[["9fcfffd7.912ba","9cd8db3a.d6a538"]]},{"id":"9fcfffd7.912ba","type":"debug","z":"b5423d16.2f2fe","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":927,"y":197,"wires":[]},{"id":"9cd8db3a.d6a538","type":"function","z":"b5423d16.2f2fe","name":"GetConfig","func":"var config = flow.get('config');\nmsg.payload = config;\nreturn msg;\n","outputs":1,"noerr":0,"x":560.5,"y":278,"wires":[["5c20ae15.7140b"]]},{"id":"5c20ae15.7140b","type":"debug","z":"b5423d16.2f2fe","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":728.5,"y":283,"wires":[]},{"id":"e9555e53.7140c","type":"inject","z":"b5423d16.2f2fe","name":"inject2","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":362,"y":279,"wires":[["9cd8db3a.d6a538"]]},{"id":"b3370a35.5fec48","type":"function","z":"b5423d16.2f2fe","name":"Query","func":"msg.payload = \"SELECT DISTINCT \\\"RoomName\\\", \\\"DeviceID\\\", \\\"Active\\\" \" +\n\t \"FROM public.configuration\";\nreturn msg;","outputs":1,"noerr":0,"x":326,"y":164,"wires":[["d5b6494d.9728c8"]]},{"id":"d5b6494d.9728c8","type":"postgres","z":"b5423d16.2f2fe","postgresdb":"c4ed9674.384ab8","name":"AvailableRooms","output":true,"outputs":1,"x":522,"y":169,"wires":[["27f185b9.9f29ca"]]},{"id":"c4ed9674.384ab8","type":"postgresdb","z":"","hostname":"localhost","port":"5432","db":"heating","ssl":false}]

If it has a branch (I haven't looked) then it may well not be cloning the message before sending... as nodejs passes variables by reference then the two instances are actually the same instance (unless cloned) - so what happen in one branch may well affect the other... - the owner of that node need to alerted - so raise an issue with the details as you found.

I just looked at the code, and what Dave is describing is exactly what is going on. Spot on.

There's also an open issue regarding the last line shown (154) causing issues. That might be the other situation you describe. It might have to do with the client disconnecting while still in the handler for client.query.

Thank you both for the feedback and letting me know that i'm not just doing something stupid. Now for my next stupid question. How do I let the developer know that there is an issue with his node. Looking on line the "Issues · node-red/node-red · GitHub" link is only for core nodes. It recommends putting issues with 3rd party nodes on this forum "https://discourse.nodered.org" but how do I get the developer tagged. "lotockii"

Also, there is several different nodes that I could use for postgresql in Node-Red. Would you have any suggestions on picking the best node when a number are available. I usually go for, description that shows the most easily used, most downloads in the past month (Leads me to believe that a lot of people are using it), Last update (the more recent means the most support and updated node) and a high version number (continually updated). but maybe i'm totally wrong!

Thanks

Here you go. You can find the link to the node’s github repository through the flows library by searching for the name of the node.

1 Like