Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f5CHKZE63968 for ; Tue, 12 Jun 2001 13:20:35 -0400 (EDT) (envelope-from pgsql-general-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5CEx6E95242; Tue, 12 Jun 2001 10:59:06 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f5CEWeX38430; Tue, 12 Jun 2001 10:32:40 -0400 (EDT) (envelope-from news) From: alla@sergey.com (Alla) X-Newsgroups: comp.databases.postgresql.general,comp.databases.postgresql.sql Subject: Please help! Functions passing records between them Date: 12 Jun 2001 07:32:37 -0700 Organization: http://groups.google.com/ Lines: 62 Message-ID: <9275d56e.0106120632.456dd846@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-support@google.com To: pgsql-general@postgresql.org.pgsql-sql@postgresql.org X-Archive-Number: 200106/425 X-Sequence-Number: 10819 Guys; I am begging for your help again. I can't find a solution to my problem. I am porting a complex system from Oracle to PostgreSQL and I need to implement the following: function 1 does some processing and returns a record (I can declare it as a row in a view) function 2 uses func1 to get that record and does some more processing My problem is that even if I can return a record from my function 1, function 2 does not read it properly Here is an example: create view my_view as select null as type, null as value, null as timestamp; -- this is how I "declare" the user-defined data structure (I could not find any other way) create function func1() returns my_view as ' declare my_record my_view%rowtype; begin ..... ..... my_record.type := ''AAA''; my_record.value := 25; my_record.timestamp := now(); -- this is for simplicity return my_record; end; ' LANGUAGE 'plpgsql'; create function func2() returns varchar as ' declare my_record my_view%rowtype; begin select func1() into my_record; return my_record.type; end; ' LANGUAGE 'plpgsql'; It compiles and runs fine, except that it does not return what it's supposed to. It gives me some strange huge number, which I assume is some kind of OID I know that there are quite a few gurus of PostgreSQL out there - please help me solve this problem. May be my whole approach is wrong, but I need to be able to accomplist this: pass some kind of user-defined structures between function Thank you so much for your help Alla Gribov