Re: 2 questions about types

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: 2 questions about types
Дата
Msg-id 4238516F.8080008@archonet.com
обсуждение исходный текст
Ответ на Re: 2 questions about types  (Jason Tesser <jtesser@nbbc.edu>)
Ответы Re: 2 questions about types  (Jason Tesser <jtesser@nbbc.edu>)
Список pgsql-general
Jason Tesser wrote:
> OK here is an example of a function where I had to create a type called
> login.
> How could I have written this function without having to create a type.
>
> CREATE OR REPLACE FUNCTION "public"."loginbyindidget" (integer) RETURNS
> SETOF "public"."login" AS'
[snip]

There's an example in the manuals - chapter "7.2.1.4. Table Functions"

SELECT *
     FROM dblink('dbname=mydb', 'select proname, prosrc from pg_proc')
       AS t1(proname name, prosrc text)
     WHERE proname LIKE 'bytea%';

So basically, you need to supply the type definitions in your SELECT if
you aren't going to supply it in the function definition.
--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: generating statistics
Следующее
От: Tom Lane
Дата:
Сообщение: Re: plPerl subroutine