Daniel Futerman wrote:

Is it possible to have UPDATE JOIN queries in PostgreSQL?

Yes:

UPDATE target
    ....
FROM othertable;

As far as I know Pg can only do an inner join on the update target. This can be easily be turned into an outer join with something like:

UPDATE target
   ....
FROM target t LEFT OUTER JOIN othertable
WHERE target.id = t.id;

or similar. I haven't checked to see whether this results in an extra scan in the query plan; you might want to use EXPLAIN ANALYZE to examine how Pg will execute the query.

--
Craig Ringer

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to