"geraldo" <[EMAIL PROTECTED]> writes: > Can anybody tell me why the following code when activated > by a select only affects the first line of the table??? > create or replace function increase(integer) > returns void as 'update tab set price=price*(1+$1/100.0)' > language sql;
Works fine here. regression=# create table tab (price numeric); CREATE TABLE regression=# insert into tab values(1); INSERT 154584 1 regression=# insert into tab values(10); INSERT 154585 1 regression=# insert into tab values(100); INSERT 154586 1 regression=# select * from tab; price ------- 1 10 100 (3 rows) regression=# create or replace function increase(integer) regression-# returns void as 'update tab set price=price*(1+$1/100.0)' regression-# language sql; CREATE FUNCTION regression=# select increase(42); increase ---------- (1 row) regression=# select * from tab; price -------------------------- 1.42000000000000000000 14.20000000000000000000 142.00000000000000000000 (3 rows) regression=# regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match