X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 82EE5475A8D for ; Mon, 21 Apr 2003 17:53:51 -0400 (EDT) Received: from lautaro.compuall.cl (50-126-125.leased.cust.tie.cl [200.50.126.125]) by postgresql.org (Postfix) with ESMTP id 578EC474E42 for ; Mon, 21 Apr 2003 17:53:46 -0400 (EDT) Received: from lautaro.compuall.cl (lautaro [127.0.0.1]) by lautaro.compuall.cl (8.12.8/8.12.5) with ESMTP id h3LLwgPt012829; Mon, 21 Apr 2003 17:58:42 -0400 Received: (from apache@localhost) by lautaro.compuall.cl (8.12.8/8.12.5/Submit) id h3LLwcRA012827; Mon, 21 Apr 2003 17:58:38 -0400 X-Authentication-Warning: lautaro.compuall.cl: apache set sender to mario_soto@compuall.cl using -f Received: from 192.168.1.100 (SquirrelMail authenticated user mario_soto) by www.compuall.cl with HTTP; Mon, 21 Apr 2003 17:58:38 -0400 (CLT) Message-ID: <1888.192.168.1.100.1050962318.squirrel@www.compuall.cl> Date: Mon, 21 Apr 2003 17:58:38 -0400 (CLT) Subject: Re: PROBLEM WITH FUNCTIONS From: "Mario Alberto Soto Cordones" To: In-Reply-To: References: <1848.192.168.1.100.1050961085.squirrel@www.compuall.cl> X-Priority: 1 Importance: High Cc: X-Mailer: SquirrelMail (version 1.2.10) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-25.5 required=5.0 tests=BAYES_01,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,X_AUTH_WARNING,X_PRIORITY_HIGH 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/312 X-Sequence-Number: 13013 Thank Randall this select * from get_unidades(10, 1, 15, 17); work very good thank, very much Muchas, Muchas gracias un gran saludo desde chile Mario > Mario, > > If your function returns a record, you have to treat it like it's a > relation (table). So you don't select it, you select from it. > > Try: > > select * from get_unidades(10, 1, 15, 17); > > Also you may have to give it an explicit variable list such as: > > select * from get_unidades(10,1,15,17) as (codigo numeric(3,0), > descripcion text); > > Best, > > Randall > > On Monday, April 21, 2003, at 05:38 PM, Mario Alberto Soto Cordones > wrote: > >> Hi. >> >> i have a 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 =3D $1 and >> cuseduni =3D $2 and >> cucaruni =3D $3 and >> cuasiuni=3D $4 >> ; ' LANGUAGE 'sql'; >> >> and at this moment=B4s it=B4s all ok BUT when execute this function >> select get_unidades(10,1,15,17) >> >> say >> "cannot display a value of type RECORD" >> >> any idea, PLEASE HELP MY >> >> saludos >> >> >> ---------------------------(end of >> broadcast)--------------------------- >> TIP 4: Don't 'kill -9' the postmaster >> > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster --=20 Mario Soto Cordones Gerente de Proyectos Compuall Ingenier=EDa Ltda.