X-Original-To: pgsql-sql@postgresql.org Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 1F42347611A for ; Fri, 21 Mar 2003 15:13:33 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 8CC98D636; Fri, 21 Mar 2003 12:13:33 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 828405C02; Fri, 21 Mar 2003 12:13:33 -0800 (PST) Date: Fri, 21 Mar 2003 12:13:33 -0800 (PST) From: Stephan Szabo To: Mario Alberto Soto Cordones Cc: Subject: Re: In-Reply-To: <33010.192.168.1.100.1048272623.squirrel@mail.compuall.cl> Message-ID: <20030321121210.V85996-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200303/513 X-Sequence-Number: 12552 On Fri, 21 Mar 2003, Mario Alberto Soto Cordones wrote: > CREATE or replace FUNCTION get_nombre(numeric,numeric,text) RETURNS setof > cumaalu AS ' > SELECT cunomalu,cuappalu,cuapmalu FROM cumaalu > WHERE siempalu = $1 and > cusesalu = $2 and > curutalu = $3; > ' LANGUAGE SQL; > > > the error say > > PostgreSQL ha dicho: ERROR: function declared to return cumaalu does not > SELECT the right number of columns (49) > Your query: > CREATE FUNCTION get_nombre(numeric,numeric,text) RETURNS setof cumaalu AS ' > SELECT cunomalu,cuappalu,cuapmalu FROM cumaalu > WHERE siempalu = $1 and > cusesalu = $2 and > curutalu = $3; > ' LANGUAGE SQL > > > please any idea., i canṫ't use select * becose the table its very long. If you really want to return just three of the 49 columns, make a composite type (see CREATE TYPE AS (...) ) and return a set of that type.