Re: SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo - Mailing list pgsql-sql

From Jean-Luc Lachance
Subject Re: SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo
Date
Msg-id 41221580.7070907@sympatico.ca
Whole thread Raw
In response to SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo  (Markus Bertheau <twanger@bluetwanger.de>)
Responses Re: SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo  (Markus Bertheau <twanger@bluetwanger.de>)
List 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
> 



pgsql-sql by date:

Previous
From: Markus Bertheau
Date:
Subject: Re: SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo
Next
From: Stephan Szabo
Date:
Subject: Re: multi column foreign key for implicitly unique columns