> 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