X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5332CD6EED; Tue, 30 Aug 2005 23:32:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44693-10; Wed, 31 Aug 2005 02:32:50 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id B1AE8D6EEC; Tue, 30 Aug 2005 23:32:48 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j7V2WoMm025338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 30 Aug 2005 20:32:52 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j7V2WoA3094353; Tue, 30 Aug 2005 20:32:50 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j7V2Wopk094352; Tue, 30 Aug 2005 20:32:50 -0600 (MDT) (envelope-from mfuhr) Date: Tue, 30 Aug 2005 20:32:49 -0600 From: Michael Fuhr To: Postgres Admin Cc: pgsql-sql@postgresql.org, PostgreSQL - Admin Subject: Re: [SQL] plpgsql question Message-ID: <20050831023249.GA94269@winnie.fuhr.org> References: <1C7C5DE3-5EB5-4EB8-A187-290EF5081BD7@sitening.com> <4314863A.3030107@productivitymedia.com> <20050830165013.GA57465@winnie.fuhr.org> <43149E68.8030600@productivitymedia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43149E68.8030600@productivitymedia.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 required=5 tests=[AWL=0.005] X-Spam-Level: X-Archive-Number: 200508/405 X-Sequence-Number: 18724 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