Re: SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo

From: Jean-Luc Lachance <jllachan(at)sympatico(dot)ca>
To: Markus Bertheau <twanger(at)bluetwanger(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo
Date: 2004-08-17 14:26:08
Message-ID: 41221580.7070907@sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

This query does not make sense to me.
Why would you create an updatable subquery just to get the highest value?

Maybe you are trying to achieve something other than what the query
suggest. You wou care to put in words what you want to do?

JLL

Markus Bertheau wrote:

> Hi,
>
> why is the following query not allowed:
>
> SELECT MAX(position) FROM (SELECT position FROM classes WHERE name =
> 'foo' FOR UPDATE OF classes) AS foo
>
> It's clear which rows should be locked here, I think.
>
> Thanks
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2004-08-17 14:26:56 Re: multi column foreign key for implicitly unique columns
Previous Message Markus Bertheau 2004-08-17 14:21:32 Re: SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo