Re: Tuple concurrency issue in large objects

From: Rene Romero Benavides <rene(dot)romero(dot)b(at)gmail(dot)com>
To: Shalini <shalini(at)saralweb(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Tuple concurrency issue in large objects
Date: 2019-12-10 05:54:03
Message-ID: CANaGW0_DJ041bLmOmjayZacUFcR8u9fP0CteBoAVYk2weFqGvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Shalini. The usual diagnostic info is your postgresql server version,
major and minor version, such as in 12.1 , the major version is 12 and the
minor version (patch version) is 1.

On Fri, Dec 6, 2019 at 9:26 AM Shalini <shalini(at)saralweb(dot)com> wrote:

> Hi all,
>
> I am working on a project which allows multiple users to work on single
> large text document. I am using lo_put to apply only the diff into the
> large object without replacing it with a new lob. While working on it, I
> encountered an error "Tuple concurrently updated".
> The error can be reproduced with two psql clients.
>
> Setup:
>
> mydb=# create table text_docs(id serial primary key, data oid);
> CREATE TABLE
> mydb=# insert into text_docs(data) select lo_import('./upload.txt');
> INSERT 0 1
> mydb=# select * from text_docs;
> id | data
> ----+---------
> 1 | 5810130
> (1 rows)
>
> Now, if we open two psql clients and execute the following commands:
>
> Client 1:
>
> mydb=# begin;
> BEGIN
> mydb=# select lo_put(5810130, 10, '\xaa');
> UPDATE 1
>
> Client 2:
>
> mydb=# select lo_put(5810130, 10, '\xaa');
>
> Client 1:
> mydb=# commit;
> COMMIT
>
> Client 2:
> mydb=# select lo_put(5810130, 10, '\xaa');
> ERROR: tuple concurrently updated
>
> Is there a workaround to this concurrency issue without creating a new
> large object?
>
> Regards
> Shalini
>
>
>
>
>

--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2019-12-10 07:41:37 Identity columns, DEFAULT keyword and multi-row inserts
Previous Message github kran 2019-12-09 22:37:10 Re: Upgrade PostgreSQL 9.6 to 10.6