Strange update behaviour - Mailing list pgsql-sql

From ProfiVPS Support
Subject Strange update behaviour
Date
Msg-id 257ece670da80be9e2d08126aba9c641@profivps.hu
Whole thread Raw
Responses Re: Strange update behaviour
List pgsql-sql

Hi Gentz, 

  I'm in a dire need of help, because this bug is killing me for weeks now. 

  I got a function, and that function has a simple update query in it: 

UPDATE app_devices SET device_state = p_values[1], device_updateTs = NOW(),
device_changets = CASE WHEN device_state <> p_values[1] THEN NOW() ELSE device_changets END,
device_alertstate = CASE WHEN device_state <> p_values[1] THEN 0 ELSE device_alertstate END
WHERE device_id=dev_id;


 The device_alertstate's default value is 200. update and changets are null by default. 

 And I constantly face a result when the device_state is updated, changets and updatets are populated, but the device_alertstate remains on the default 200. 

  As far as I can tell from the second round and forward it works well. 

  I am simply not able to come up with any reasons for this to happen. 


Thank you very much in advance!

Bests, 

András

---
Olcsó Virtuális szerver:
http://www.ProfiVPS.hu

Támogatás: Support@ProfiVPS.hu

pgsql-sql by date:

Previous
From: "Wetmore, Matthew (CTR)"
Date:
Subject: PostgreSQL Objects design
Next
From: Tom Lane
Date:
Subject: Re: Strange update behaviour