shyamperi@davlin.co.in writes:
> CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '
> BEGIN
> RETURN $1 + 1;
> END;
> ' LANGUAGE 'plpgsql';
> The expected ouput of the above function should be 11 when we pass the 10 t=
> o it.... but it returns 1.
Works fine for me:
regression=# CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '
regression'# BEGIN
regression'# RETURN $1 + 1;
regression'# END;
regression'# ' LANGUAGE 'plpgsql';
CREATE FUNCTION
regression=# select add_one(10);
add_one
---------
11
(1 row)
Perhaps you should show us exactly what you did.
regards, tom lane