I could use some help understanding an odd situation. I have a postgres database 'servers' with ip (inet) and load (integer) columns. I can manually update a load value via psql as follows:
UPDATE servers SET load = load + 100 WHERE ip = '10.10.10.10';
I have written a php script to automate load updates. However, the 'value = value + x' syntax is not working for me now.
pg_query($conn, "UPDATE servers SET load = 100 WHERE ip = '10.10.10.10'");
pg_query($conn, "UPDATE servers SET load = load + 100 WHERE ip = '10.10.10.10'");
When using the latter, the script hangs indefinitely without giving a response. I have tried variations such as adding an
or die(pg_last_error()) clause at the end. I have also tried using a
pg_execute statement. Still no output, and no change to the database.
Am I missing something? Is there an easy way to get around this (I'd rather not use a separate query to get load just so that I can add it back in).