X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 15B14D1B1D0 for ; Wed, 2 Jun 2004 12:55:18 -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 96110-02 for ; Wed, 2 Jun 2004 15:55:17 +0000 (GMT) Received: from web13911.mail.yahoo.com (web13911.mail.yahoo.com [216.136.174.59]) by svr1.postgresql.org (Postfix) with SMTP id F198FD1B18F for ; Wed, 2 Jun 2004 12:55:15 -0300 (ADT) Message-ID: <20040602155515.53668.qmail@web13911.mail.yahoo.com> Received: from [80.67.100.162] by web13911.mail.yahoo.com via HTTP; Wed, 02 Jun 2004 08:55:15 PDT Date: Wed, 2 Jun 2004 08:55:15 -0700 (PDT) From: "Riccardo G. Facchini" Subject: Re: function with a composite type calling another function - Mission Impossible? To: pgsql-sql@postgresql.org In-Reply-To: <24964.1086191039@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200406/16 X-Sequence-Number: 17961 --- Tom Lane <__> wrote: > "Riccardo G. Facchini" <__> writes: > > declare my_new_complex complex_number; > > > select * from complex_to_complex(my_new_complex) into my_result; > > > ERROR: column "my_new_complex" does not exist > > plpgsql doesn't presently cope with passing whole-row variables into > SQL > expressions, which is essentially what you've got here. There's some > chance it will work in time for 7.5. > > regards, tom lane then, why --- select * from complex_to_real(real_to_complex(1, 2)); select * from complex_to_complex(real_to_complex(1, 2)); --- work? and why the function definition: CREATE or replace FUNCTION public.really_really_complex(complex_number) RETURNS complex_number AS 'declare my_complex alias for $1; declare my_result complex_number; begin my_result := complex_to_complex(my_complex); return my_result; end;' LANGUAGE 'plpgsql' VOLATILE; --- doesn't make a difference? thanks for your quick answer, ===== Riccardo G. Facchini