Re: passing a record as a function argument in pl/pgsql

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: passing a record as a function argument in pl/pgsql
Дата
Msg-id 3F0242A1.7090306@joeconway.com
обсуждение исходный текст
Ответ на passing a record as a function argument in pl/pgsql  ("Alon Noy" <anoy@arti-shock.com>)
Список pgsql-sql
Alon Noy wrote:
> From what I tried it is possible to create such a function but it is not
> possible to call it ?!
> Can anyone provide an example?

create table foo (f1 int, f2 text);

insert into foo values(1,'a');
insert into foo values(2,'b');
insert into foo values(3,'c');

create or replace function get_foo(int) returns foo as 'select * from 
foo where f1 = $1' language 'sql';

create or replace function use_foo(foo) returns text as '
declare v_foo alias for $1;
begin  return v_foo.f2;
end;
' language 'plpgsql';

regression=# select use_foo(get_foo(2)); use_foo
--------- b
(1 row)

HTH,

Joe



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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: LEAST and GREATEST functions?
Следующее
От: "Don Soledad"
Дата:
Сообщение: columnar format