X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A4D73475AA9 for ; Tue, 22 Apr 2003 17:24:22 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id BD01C47592C for ; Tue, 22 Apr 2003 17:24:21 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 603FAD613; Tue, 22 Apr 2003 14:24:20 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 55FA75C0A; Tue, 22 Apr 2003 14:24:20 -0700 (PDT) Date: Tue, 22 Apr 2003 14:24:20 -0700 (PDT) From: Stephan Szabo To: Mario Alberto Soto Cordones Cc: Subject: Re: FUNCTION ERROR In-Reply-To: <1786.192.168.1.100.1051046246.squirrel@www.compuall.cl> Message-ID: <20030422141744.J72250-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-25.2 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/318 X-Sequence-Number: 13019 On Tue, 22 Apr 2003, Mario Alberto Soto Cordones wrote: > Hi. > i have a big problem with a function. > i create a type unidades > CREATE TYPE unidades AS (codigo numeric(3,0), > descripcion text); > > and i create a function get_unidades > CREATE FUNCTION get_unidades(int4, int4, int4, int4) RETURNS > typeof > unidades AS ' > SELECT cucoduni, cudesuni > FROM cumauni > WHERE cuempuni = $1 and > cuseduni = $2 and > cucaruni = $3 and > cuasiuni= $4 > ; ' LANGUAGE 'sql'; > > when execute this function > > select * from get_contenidos(10,1,15,17,31,12) > as (codigo numeric(3,0), > descripcion text) > > SAY > > ERROR: ExecMakeTableFunctionResult: Invalid result from function returning > tuple > > ANY IDEA It's hard to say since you're not calling the function you gave the definition for, the function definition above isn't valid I think (I get an error at unidades after making a table with appropriate columns - fixable by replacing typeof with setof), and you didn't give the table definition for the table in question.