On Mon, 20 Nov 2006, Rafal Pietrak wrote:
> The most obvious construct I'd use is:
> UPDATE my_table set filed=newvalue WHERE
> my_function(input)=my_table.selector_field;
> but it's useless, since the function would have been be evaluated for
> every row of the table.
-- Not tested
create function update_my_table(newvalue, input)
returns void
volatile
language plpgsql
as $$
declare
selector selector_field_type;
begin
selector := my_function(input);
update my_table set filed=newvalue
where my_table.selector_field=selector;
end;
$$;
-- and then
select update_my_table(newvalue, input);
-- Not tested.
Regards
Tometzky
--
...although Eating Honey was a very good thing to do, there was a
moment just before you began to eat it which was better than when you
were...
Winnie the Pooh