Re: 2 questions about types

From: Richard Huxton <dev(at)archonet(dot)com>
To: Jason Tesser <jtesser(at)nbbc(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: 2 questions about types
Date: 2005-03-16 15:31:59
Message-ID: 4238516F.8080008@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-03-16 15:33:57 Re: plPerl subroutine
Previous Message Tom Lane 2005-03-16 15:30:54 Re: generating statistics