Re: Error with functions - Mailing list pgsql-admin

From Tom Lane
Subject Re: Error with functions
Date
Msg-id 24543.1064073740@sss.pgh.pa.us
Whole thread Raw
In response to Re: Error with functions  (shyamperi@davlin.co.in)
List pgsql-admin
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

pgsql-admin by date:

Previous
From: Christopher Smith
Date:
Subject: Re: Are 50 million rows a problem for postgres ?
Next
From: "S.P.Vimala"
Date:
Subject: Re: upgrade of 7.2.2-1 to 7.3.4