Re: Strange row locking - question

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Vaclav Kulakovsky <vaclav(dot)kulakovsky(at)definity(dot)cz>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Strange row locking - question
Date: 2002-04-11 15:40:16
Message-ID: 20020411083857.C33236-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 11 Apr 2002, Vaclav Kulakovsky wrote:

> Hi all,
>
> When I update row in table with foring key, referenced row is locked. I
> can see it in log file:
>
> DEBUG: query: update entry set sometext = 'aaa' where id = 1;
> DEBUG: query: SELECT 1 FROM ONLY "languages" WHERE "id" = $1 FOR UPDATE
> OF "languages"
>
> When I execute update second time I receive only this:
>
> query: update entry set sometext = 'aaa' where id = 1;
>
> Referenced row is locked only first time ? This behavior looks me little
> bit strange. Can anybody explain it ?

I believe this is just the query plan caching. It only plans the query
once for each session on its first use. The query is run from that saved
plan from then on.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message noy 2002-04-11 15:40:38 Date precision problem
Previous Message Stephan Szabo 2002-04-11 15:35:34 Re: SPI_execp() failed in RI_FKey_cascade_del()