Re: new "row-level lock" error messages

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new "row-level lock" error messages
Date: 2013-08-01 15:25:57
Message-ID: CA+TgmoaF9HRR+bP7pTUOyh0nppp+-G9R1gJ+mV923J5=DAt8sw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 23, 2013 at 2:16 PM, Alvaro Herrera
<alvherre(at)2ndquadrant(dot)com> wrote:
> Alvaro Herrera wrote:
>> Peter Eisentraut wrote:
>>
>> > I would suggest that these changes be undone, except that the old
>> > "SELECT FOR ..." be replaced by a dynamic string that reverse-parses the
>> > LockingClause to provide the actual clause that was used.
>>
>> Here's a patch for this.
>
> Pushed to 9.3 and master. Sample output:
>
> alvherre=# select * from foo, bar for update of foof for share of bar;
> ERROR: relation "foof" in FOR UPDATE clause not found in FROM clause
>
> alvherre=# select * from foo, bar for update of foo for share of barf;
> ERROR: relation "barf" in FOR SHARE clause not found in FROM clause
>
> Amusingly, the only test in which these error messages appeared, in
> contrib/file_fdw, was removed after the two commits that changed the
> wording. So there's not a single test which needed to be tweaked for
> this change.

The fact that there are no tests of this functionality is probably not
a good thing. We should add some. At the moment, the following test
case crashes, and it looks like this commit is responsible:

create table test_update2 (id integer);
DECLARE test_update_cursor CURSOR FOR SELECT id, MIN(id) FROM
test_update2 GROUP By id HAVING MIN(id) < 1 FOR UPDATE;

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2013-08-01 15:32:21 Re: new "row-level lock" error messages
Previous Message MauMau 2013-08-01 15:24:21 Re: [9.3 bug] disk space in pg_xlog increases during archive recovery