RE: SELECT updatability clause defective. - Mailing list pgsql-bugs

From Jerome O'Neil
Subject RE: SELECT updatability clause defective.
Date
Msg-id GCEAIKGJLCHNBFIMDEAPIEKICAAA.joneil@combimatrix.com
Whole thread Raw
In response to Re: SELECT updatability clause defective.  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Re: SELECT updatability clause defective.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
> I see it as part of declare cursor (13.1)
>
> <updatability clause> ::=
>     FOR { READ ONLY | UPDATE [ OF <column name list> ] }
>
> However, I think the updatability clause means something
> different than our for update.  If I'm reading it write, I think
> it tells you whether or not you may do positioned updates on
> the cursor.

You're right, it is part of the cursor specification, and not the query
term. My bad for the confusion.

In the cursor context, it's used to declare what columns are
updateable through the cursor.  By adding the syntax to the
raw select statement, you can declare columns updateable
through the result set.  At least that's the intent of other
vendors.

-- SQL-92, and is unsupported by Postgres.
DECLARE  mycursor CURSOR
FOR
 SELECT foo,baz FROM bar
FOR UPDATE OF foo

-- Adheres to the BNF, and is not supported by Postgres
SELECT foo,baz FROM bar FOR UPDATE OF foo

-- Breaks the BNF but is supported by Postgres
SELECT foo,baz FROM bar FOR UPDATE OF bar

Which makes me wonder:  What is the point, if not to
restrict updatability?

What is the difference between:

-- Allow updates to everything.
SELECT * FROM bar FOR UPDATE

and

-- Allow updates to everything.
SELECT * FROM bar FOR UPDATE OF bar

pgsql-bugs by date:

Previous
From: Fariba Noorbakhsh
Date:
Subject: instalation problems!
Next
From: "Eric Pare"
Date:
Subject: order by using functions under unions