On 2006-10-13, "Albe Laurenz" <[EMAIL PROTECTED]> wrote:
> You lock the table (with LOCK) or the row you're working on
> (with SELECT FOR UPDATE) so that nobody else can change it while
> you are working on it.
>
> You need something like ctid if your table has the fundamental flaw
> of lacking a p
On 10/13/06, Jean-Christophe Roux <[EMAIL PROTECTED]> wrote:
Thanks for the "ctid" trick. The code below worked fine
for rec in select * from fromemail_trades loop
update fromemail_trades set recordid = row where ctid = rec.ctid;
row := row -1;
end loop;
The first line is
Thanks for the "ctid" trick. The code below worked fine for rec in select * from fromemail_trades loop update fromemail_trades set recordid = row where ctid = rec.ctid; row := row -1; end loop;The first line is a little different from your's: FOR row IN SELECT ctid, * FROM ta
Rafal Pietrak wrote:
>> You might use 'ctid' to identify the row if you have no suitable
>
> How should I use 'ctid'? Like in the case, when I've selected
> something by means of SELECT ... FOR UPDATE?
You lock the table (with LOCK) or the row you're working on
(with SELECT FOR UPDATE) so that n
On Fri, 2006-10-13 at 09:23 +0200, Albe Laurenz wrote:
> You might use 'ctid' to identify the row if you have no suitable
How should I use 'ctid'? Like in the case, when I've selected something
by means of SELECT ... FOR UPDATE?
--
-R
---(end of broadcast)--
Jean-Christophe Roux wrote:
> I am trying to loop through a table to update one column
>
> create or replace function foo() returns integer as $$
> declare
> rec RECORD;
> row integer := 0;
> begin
> for rec in select * from table loop
> update rec set recordid = row;
>