Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: hargudekishor(at)gmail(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq
Date: 2016-08-02 19:30:42
Message-ID: 9511.1470166242@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> hargudekishor(at)gmail(dot)com wrote:
>> We have connected our node js application with postgresql-9.4.8.We have
>> several functions which are getting created in database using async call
>> from nodejs to postgresql server.but while creating those functions ,We are
>> encountered a error of "Tuple concurrently updated".

> Yeah, this is known. We haven't worried too much, because the use case
> seems thin: why are you deleting and creating the function over and
> over? Wouldn't it be better to create the function once and be done
> with it?

Note that each one of those create calls, before failing, will have had
to wait for the previous updater to commit or not. We could imagine
installing alternate behavior such as "don't fail if the new state of the
pg_proc row is exactly what you wanted anyway"; but I do not see any
useful semantics that would not involve waiting to see if the prior
transaction commits. And then there's the cost of the bloat that you're
creating in the pg_proc catalog. So quite aside from the possibility of
a concurrent-update failure, you'd be much better off from a performance
standpoint if you take the trouble to not repetitively create the same
function.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2016-08-02 21:42:07 Re: Fwd: [BUGS] BUG #14247: COMMENT is restored on wrong database
Previous Message Peter Eisentraut 2016-08-02 18:06:30 Re: BUG #12884: configure script fails on a platform with /tmp directory read only