Re: Function to return a multiple colmn table or view - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Function to return a multiple colmn table or view
Date
Msg-id 462E27D4.5020307@archonet.com
Whole thread Raw
In response to Function to return a multiple colmn table or view  ("Wilkinson, Jim" <Jim.Wilkinson@cra-arc.gc.ca>)
List 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


pgsql-sql by date:

Previous
From: Ragnar
Date:
Subject: Re: hi
Next
From: Stephan Szabo
Date:
Subject: Re: hi