Re: Function to return a multiple colmn table or view

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Wilkinson, Jim" <Jim(dot)Wilkinson(at)cra-arc(dot)gc(dot)ca>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Function to return a multiple colmn table or view
Date: 2007-04-24 15:52:52
Message-ID: 462E27D4.5020307@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Don't forget to cc: the list

Wilkinson, Jim wrote:
> Hi Richard, your example worked find , but when I substitue my view into
> the function and the tale name, I get the following error:
>
> ERROR: wrong record type supplied in RETURN NEXT
> CONTEXT: Pl/pqSQL function "create_view" line 11 at return next

The columns you're returning from the function don't match it's definition.

If the function is defined as RETURNS SETOF X then it needs to return
columns that match X. If you need to you can create a custom type (see
"CREATE TYPE" in the manuals).

If you want one function that returns different types then you can't
have it.

--
Richard Huxton
Archonet Ltd

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2007-04-24 16:41:26 Re: hi
Previous Message Ragnar 2007-04-24 15:05:29 Re: hi