From: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: UPDATE in a specific order
Date: 16 Dec 2010 19:58:50 GMT
Message-ID: <iedr1q$dv1$1@reversiblemaps.ath.cx> (raw)
References: <4D0A28F0.3020205@planit.com.br>
> I need to make update of table1 with data on table2 in the order of id
> of table2
that looks like EAV. is it?
> I=B4m trying to do an update like this:
that's not going to work.
perhaps you can rewrite the from part to only return one row for every
table1_fk, this one row will combine several rows from table2
> The "FROM ( SELECT * FROM table2 ORDER BY id ) tHist" is a try to
> force a specific order on table2 to update table1
> but this isn=B4t working.
will only work if the optimiser picks index join on table 1
> There are some way to do this with a UPDATE statement ?
to do it with an update statement you need no more than one rows in the
from for each row in the target.
easiest non update statement approach is probably to use a plpgsql
function with a loop.
basically you need to find another way to do it.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasen@xnet.co.nz
Subject: Re: UPDATE in a specific order
In-Reply-To: <iedr1q$dv1$1@reversiblemaps.ath.cx>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox