X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1F1768B9EAE; Mon, 21 Feb 2005 06:39:12 +0000 (GMT) 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 34387-04; Mon, 21 Feb 2005 06:39:08 +0000 (GMT) Received: from millenium.mst.co.jp (millenium.mst.co.jp [210.251.240.193]) by svr1.postgresql.org (Postfix) with ESMTP id B39F88B9E41; Mon, 21 Feb 2005 06:39:07 +0000 (GMT) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id j1L6cdQ18742; Mon, 21 Feb 2005 15:38:39 +0900 Message-ID: <000c01c517e0$830679c0$7201a8c0@mst1x5r347kymb> From: "Iain" To: "Chari Clark" , , References: <4214FDD6.3070609@nationalbackgrounddata.com> Subject: Re: PostgreSQL Errors... Date: Mon, 21 Feb 2005 15:42:23 +0900 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/185 X-Sequence-Number: 16353 Hi, try doing it this way and work from there: select sp_items('85000000000001'); regards Iain ----- Original Message ----- From: "Chari Clark" To: ; Sent: Friday, February 18, 2005 5:25 AM Subject: [ADMIN] PostgreSQL Errors... >I created the following statement: > > CREATE TYPE get_item_info_type AS (full_name varchar(300),dob > varchar(300)); > > CREATE OR REPLACE FUNCTION sp_items(int8) RETURNS get_item_info_type AS > ' > DECLARE > in_id items.item_no%TYPE; > BEGIN > select > coalesce(full_name, '') as fullname, > coalesce(dob, '') as dob > from > items > where > item_no = in_id > ; > RETURN; > END; > ' > LANGUAGE 'plpgsql'; > > This statement compiles fine, but when calling the funtion from a SELECT > statement for a specific item, I get the following error message: > > select * FROM sp_items('85000000000001'); > > ERROR: return type mismatch in function returning tuple at or near ";" > CONTEXT: compile of PL/pgSQL function "sp_aliases" near line 14 > > In order to return fullname and dob, I'm not sure if the data type for > sp_items needs to match the get_item_info_type or what. > > I think this is my last hurdle, so any help would be over-greatly > appreciated. > > Thanks, > > -- > Chari Clark > Database Administrator > National Background Data, LLC > A First Advantage Company (NASDAQ: FADV) > > 352.629.9913 > cclark@nationalbackgrounddata.com > www.nationalbackgrounddata.com > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster