'How to get order data updated by other user

Order are in table

    create table order ( 
      dokumnr int primary key,
      packno char(10)
      );
   insert into order dokumnr values (123);

One user sets pack number using

update order set packno='Pack1' where dokumnr=123

3 seconds later other user retrieves pack number using

select packno from order where dokumnr=123

However, other user gets null value, not Pack1 as expected. After some time later, correct value Pack1 is returned.

How to get updated data from other user immediately? 3 seconds is long time. It is expected that select returns updated data.

There are lot of transactions running concurrently. Maybe update command is not written to database if second user retrieves it.

How to flush orders table so that current results are returned for second user select ?

Using

PostgreSQL 13.2 and psqlODBC driver.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source