Re: Problems with triggers and table lock

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Job <Job(at)colliniconsulting(dot)it>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problems with triggers and table lock
Date: 2017-12-02 15:22:46
Message-ID: CANu8Fiy6MQJAqfegfjRWT_z1-CRx_H==P2iHaLsRHW5fP1ZyiQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Dec 1, 2017 at 4:39 PM, Job <Job(at)colliniconsulting(dot)it> wrote:

> Dear guys,
>
> we are using Postgresql 9.6.1 with Rubyrep in order to replicate some
> tables across two different, and remote, database servers.
> Since few weeks sometimes when inserting/updating some rows, the statement
> remains waiting and table seems locked for insert/updates.
>
> When i issue "select * from pg_stat_activity" no query is locked.
> I only obtain this error messages when i kill (i also try directly from
> bash with pgsql) with "ctrl+c" the locked insert:
>
> ERROR: canceling statement due to user request
> CONTEXT: while updating tuple (0,7) in relation "TABLE"
> SQL statement "UPDATE TABLE SET FIELD=NOW() WHERE FIELD IS NULL"
> PL/pgSQL function TRIGGER_NAME() line 3 at SQL statement
>
> How can i see what is locking my table/tables?
>
> Thank you!
> F
>

>How can i see what is locking my table/tables?

The attached query will give you all the necessary info.

--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

Attachment Content-Type Size
current_locks.sql text/plain 529 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Zach Walton 2017-12-02 19:02:00 Warm standby can't start because logs stream too quickly from the master
Previous Message Sameer Kumar 2017-12-02 12:55:13 Re: pg data backup from vps