pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Andrus <kobruleht2@hot.ee>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to get updated order data
Date: Fri, 08 Apr 2022 14:26:42 +0200
Message-ID: <54be8b47fad3440b377ae2e53d02b5ca60a6c2a7.camel@cybertec.at> (raw)
In-Reply-To: <1a7a890c-3a74-e9ad-70b0-78f817a082bb@hot.ee>
References: <1a7a890c-3a74-e9ad-70b0-78f817a082bb@hot.ee>

On Thu, 2022-04-07 at 16:16 +0300, Andrus wrote:
> Orders 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 suld retrieve update 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, compiled by Visual C++ build 1914, 64-bit
>   and psqlODBC driver.

That cannot happen, unless

a) the UPDATE runs in a transaction that hasn't been committed

b) the SELECT is running on a standby server, and there is replication lag

Yours,
Laurenz Albe

-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (3+ messages)  latest in thread

Message-ID: <54be8b47fad3440b377ae2e53d02b5ca60a6c2a7.camel@cybertec.at>
Permalink:  ../54be8b47fad3440b377ae2e53d02b5ca60a6c2a7.camel@cybertec.at/
Also on:    postgresql.org/message-id/54be8b47fad3440b377ae2e53d02b5ca60a6c2a7.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, kobruleht2@hot.ee
  Subject: Re: How to get updated order data
  In-Reply-To: <54be8b47fad3440b377ae2e53d02b5ca60a6c2a7.camel@cybertec.at>
  References: <1a7a890c-3a74-e9ad-70b0-78f817a082bb@hot.ee> <54be8b47fad3440b377ae2e53d02b5ca60a6c2a7.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox