Strange update behaviour

From: ProfiVPS Support <support(at)profivps(dot)hu>
To: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Strange update behaviour
Date: 2023-06-22 21:49:15
Message-ID: 257ece670da80be9e2d08126aba9c641@profivps.hu
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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(at)ProfiVPS(dot)hu

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2023-06-22 22:11:22 Re: Strange update behaviour
Previous Message Wetmore, Matthew (CTR) 2023-04-20 18:40:57 PostgreSQL Objects design