returning results from an update for joining other tables

From: Patrick Scharrenberg <pittipatti(at)web(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: returning results from an update for joining other tables
Date: 2008-06-10 08:50:52
Message-ID: 484E406C.1070602@web.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi!

I have a table containing data and a column which holds information on
which compute-node processes the data. In a given interval I'd like to
request some data from this table and mark these returned rows by
setting the "process_node" column to the node-name, which asked for data.
There may also be rows which have the column process_node set to the
name of the node currently asking.

What I tried was something like this, which gave me a syntax error:

SELECT * FROM
( UPDATE ta
SET process_node='nodename'
WHERE a>10 AND process_node is null
RETURNING *
) AS ta
JOIN someothertable ON ...

Can I somehow select some rows and do multiple operations on exactly
this resultset?
In my case update columns, then join columns from other tables and then
return the resultset with the joined columns?

Regards
Patrick

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2008-06-10 09:07:31 Re: returning results from an update for joining other tables
Previous Message hubert depesz lubaczewski 2008-06-09 16:49:21 Re: Unable to create function which takes no arguments