pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Postgres Admin <postgres@productivitymedia.com>
Cc: pgsql-sql@postgresql.org, PostgreSQL - Admin <pgsql-admin@postgresql.org>
Subject: Re: [SQL] plpgsql question
Date: Tue, 30 Aug 2005 20:32:49 -0600
Message-ID: <20050831023249.GA94269@winnie.fuhr.org> (raw)
In-Reply-To: <43149E68.8030600@productivitymedia.com>
References: <BAY101-DAV8EA3AA3EF2A17C6F7C9EEA3B60@phx.gbl>
	<F104769F-4833-4E10-892B-8EDCC0AE0E27@sitening.com>
	<BAY101-DAV106551B6BE74061AD63302A3AF0@phx.gbl>
	<1C7C5DE3-5EB5-4EB8-A187-290EF5081BD7@sitening.com>
	<4314863A.3030107@productivitymedia.com>
	<20050830165013.GA57465@winnie.fuhr.org>
	<43149E68.8030600@productivitymedia.com>

On Tue, Aug 30, 2005 at 01:59:04PM -0400, Postgres Admin wrote:
> ERROR:  set-valued function called in context that cannot accept a set
> CONTEXT:  PL/pgSQL function "article_sample" line 10 at return next

You don't show what you did to get this error, but I'd guess you
called the function like this:

  SELECT article_display(10, 0);  -- wrong

You should have called it like this:

  SELECT * FROM article_display(10, 0);

The function as posted has a few other problems, like returning the
wrong type (you return a RECORD variable instead of an article_output
variable) and not selecting enough columns for the declared return
type.  The return type also doesn't match the type shown in the
CREATE TYPE statement, and the CREATE TYPE statement fails with a
syntax error due to a missing comma.  As I mentioned previously,
please post the *exact* code you're running so typographic errors
in the message don't distract from the real problem.  Those typos
prevent people from loading the code into their own database so
they can test it unless they correct the mistakes, and then they
can't be sure they're running the same thing you are.

-- 
Michael Fuhr



view thread (14+ messages)  latest in thread

Message-ID: <20050831023249.GA94269@winnie.fuhr.org>
Permalink:  ../20050831023249.GA94269@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20050831023249.GA94269@winnie.fuhr.org

 · 

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: mike@fuhr.org, postgres@productivitymedia.com, pgsql-admin@postgresql.org
  Subject: Re: [SQL] plpgsql question
  In-Reply-To: <20050831023249.GA94269@winnie.fuhr.org>

* 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