From: Shalini <shalini@saralweb.com>
To: Rene Romero Benavides <rene.romero.b@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Tuple concurrency issue in large objects
Date: Wed, 11 Dec 2019 10:42:51 +0530
Message-ID: <d1a4d2e2-3f15-74e1-3075-6fff29010e82@saralweb.com> (raw)
In-Reply-To: <CANaGW0_DJ041bLmOmjayZacUFcR8u9fP0CteBoAVYk2weFqGvQ@mail.gmail.com>
References: <610855df-f400-4cc3-6d81-85030ff05fa1@saralweb.com>
<CANaGW0_DJ041bLmOmjayZacUFcR8u9fP0CteBoAVYk2weFqGvQ@mail.gmail.com>
Hi Rene,
I am using Postgresql 11.2. Major version is 11 and minor version is 2.
On 12/10/2019 11:24 AM, Rene Romero Benavides wrote:
> 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@saralweb.com
> <mailto:shalini@saralweb.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/
>
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: shalini@saralweb.com, rene.romero.b@gmail.com
Subject: Re: Tuple concurrency issue in large objects
In-Reply-To: <d1a4d2e2-3f15-74e1-3075-6fff29010e82@saralweb.com>
References: <610855df-f400-4cc3-6d81-85030ff05fa1@saralweb.com> <CANaGW0_DJ041bLmOmjayZacUFcR8u9fP0CteBoAVYk2weFqGvQ@mail.gmail.com> <d1a4d2e2-3f15-74e1-3075-6fff29010e82@saralweb.com>
* 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