table functions + user defined types

Поиск
Список
Период
Сортировка
От BARTKO, Zoltan
Тема table functions + user defined types
Дата
Msg-id 00b701c39c9d$e9633f60$0e5d10ac@antik.org
обсуждение исходный текст
Ответы Re: table functions + user defined types  (Adam Witney <awitney@sghms.ac.uk>)
Список pgsql-general
Ladies and Gentlemen,
 
Please, enlighten me, if you can, in the following matter:
 
I made a type:
 
create type my_type as (
    a integer,
    b integer
);
 
since I have a table:
 
create table my_table (
    a integer;
);
 
and I have now a function too:
 
create or replace function my_func (
    integer, -- a
    integer, -- b
) returns setof my_type as
'
declare
    pa alias for $1;
    pb alias for $2;
    -- declarations
    my_value    my_type;
begin
    my_value.a := pa;
    my_value.b := pb;
    return my_value;
end;
' language 'plpgsql';
 
when I run this darling function I get a parse error pointing to the line after "begin".
 
What am I doing wrong? I have skimmed through all the manuals, had a look at the postgresql cookbook, no info on this.  I just would like to have a function that returns more fields at the same time - add a column to table my_table, where I could occasionally return some value (e.g. error code). How to do this?
 
Thanks for your advice in advance
 
Zoltan Bartko
 

В списке pgsql-general по дате отправления:

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: Recomended FS
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: [OT] Choosing a scripting language.