Re: Question about passing User defined types to functions

From: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Cc: ddurst(at)larubber(dot)com
Subject: Re: Question about passing User defined types to functions
Date: 2003-01-30 15:29:08
Message-ID: 3E3944C4.7D1226BE@rodos.fzk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>
> CREATE TYPE dumby_type AS (dumby_id int4, dumby_name text);
>
> create function kick_dumby(dumby dumby_type) returns INTEGER AS '
> DECLARE
> somenumber integer;
> BEGIN
> return 1;
> END;
> ' language 'plpgsql';
>
>
> Is there some way of doing this, because the above doesn't work.
>
After having a look into the documentation on CREATE TYPE
I would say the statement looks very wrong. But I haven't done
any user defined type so far, so I can't be of any help in this case.
The CREATE FUNCTION statement is not considered to accept
parameter names within the parameter list.
So use
create function kick_dumby(dumby_type) returns INTEGER AS '
DECLARE
dumby ALIAS FOR $1;
...

Regards, Christoph

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-01-30 15:39:59 Re: Question about passing User defined types to functions
Previous Message Tambet Matiisen 2003-01-30 15:15:03 Re: Function executing twice