Re: Error with functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: shyamperi(at)davlin(dot)co(dot)in
Cc: jeanmichel(dot)chabanne(at)free(dot)fr, pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: Error with functions
Date: 2003-09-20 16:02:20
Message-ID: 24543.1064073740@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

shyamperi(at)davlin(dot)co(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Andrzej Schulz 2003-09-20 22:42:41 Re: initdb problem
Previous Message Christopher Smith 2003-09-20 14:12:08 Re: Are 50 million rows a problem for postgres ?

Browse pgsql-sql by date

  From Date Subject
Next Message yogesh selukar 2003-09-20 17:05:12 Re: Simple concatenation in select query
Previous Message Peter Eisentraut 2003-09-20 15:38:59 Re: sub query