X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7193A32A1BA for ; Wed, 20 Oct 2004 16:53:07 +0100 (BST) 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 86574-09 for ; Wed, 20 Oct 2004 15:53:05 +0000 (GMT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id B0CBC32A084 for ; Wed, 20 Oct 2004 16:53:04 +0100 (BST) Received: from lfix.demon.co.uk ([80.177.205.209] helo=cerberus.lfix.co.uk) by anchor-post-35.mail.demon.net with esmtp (Exim 4.42) id 1CKJiA-0001Q8-Gk; Wed, 20 Oct 2004 16:53:18 +0000 Received: from linda.lfix.co.uk ([192.168.1.1]) by cerberus.lfix.co.uk with esmtp (Exim 4.34) id 1CKIle-0007rc-NB; Wed, 20 Oct 2004 16:52:50 +0100 Subject: Re: code in docs gives me an error From: Oliver Elphick Reply-To: olly@lfix.co.uk To: "Hicham G. Elmongui" Cc: pgsql-docs@postgresql.org In-Reply-To: References: Content-Type: text/plain Organization: LFIX Limited Message-Id: <1098287570.24233.32.camel@linda> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Wed, 20 Oct 2004 16:52:50 +0100 Content-Transfer-Encoding: 7bit X-LFIX-MailScanner: Found to be clean X-MailScanner-From: olly@lfix.co.uk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/50 X-Sequence-Number: 2619 On Tue, 2004-10-19 at 15:21, Hicham G. Elmongui wrote: > I tried creating the function (from sec 19.3.1). But it gives me the > following error: "ERROR: type tablename does not exist". > Any ideas of what i might be doing wrong? > > CREATE FUNCTION use_many_fields(tablename) RETURNS TEXT AS ' You are passing a composite type for a row from the table called "tablename"; such a table does not exist. Use the name of a table that actually exists (and has the fields named in the RETURN statement). > DECLARE > in_t ALIAS FOR $1; > BEGIN > RETURN in_t.f1 || in_t.f3 || in_t.f5 || in_t.f7; > END; > ' LANGUAGE 'plpgsql'; -- Oliver Elphick olly@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA ======================================== "For the LORD God is a sun and shield; the LORD will give grace and glory; no good thing will he withhold from them that walk uprightly." Psalms 84:11