pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Wilkinson, Jim <Jim.Wilkinson@cra-arc.gc.ca>
To: pgsql-sql@postgresql.org
Subject: Re: Function to return a multiple colmn table or view
Date: Tue, 24 Apr 2007 16:52:52 +0100
Message-ID: <462E27D4.5020307@archonet.com> (raw)
In-Reply-To: <7CCC5BEF5E72394C963E529B54EB4A642A1A13@SD01ITMV12.PROD.NET>
References: <7CCC5BEF5E72394C963E529B54EB4A642A1A13@SD01ITMV12.PROD.NET>

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



view thread (3+ messages)

Message-ID: <462E27D4.5020307@archonet.com>
Permalink:  ../462E27D4.5020307@archonet.com/
Also on:    postgresql.org/message-id/462E27D4.5020307@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, Jim.Wilkinson@cra-arc.gc.ca
  Subject: Re: Function to return a multiple colmn table or view
  In-Reply-To: <462E27D4.5020307@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox