X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 163579FB213 for ; Thu, 3 Aug 2006 14:29:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 49461-09 for ; Thu, 3 Aug 2006 14:29:28 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 1C0BE9FAE4E for ; Thu, 3 Aug 2006 14:29:28 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id D9B1474CAF; Thu, 3 Aug 2006 18:29:26 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9AA3C4DB39; Thu, 3 Aug 2006 18:29:26 +0100 (BST) Message-ID: <44D23276.4090100@archonet.com> Date: Thu, 03 Aug 2006 18:29:26 +0100 From: Richard Huxton User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: Sylvain Racine Cc: pgsql-sql@postgresql.org Subject: Re: Function not return zero record References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.6 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/28 X-Sequence-Number: 25986 Sylvain Racine wrote: > Hello, > > I wrote a simple function who checks in a table an address and returns > the id and coordinates of the corresponding address. > > The problem is when I run separately the SQL query, it gives me zero (0) > entry when I submit a new address - it is what I want as result - and > when I run my function, it gives me 1 entry with the same address. > > Note: I create a pseudo-type to return the result. Is that my problem? The problem is the difference between a value of type getCache and a set of values of type getCache. Define your function as returning a SETOF getCache Call it with SELECT * FROM getCache(...) HTH -- Richard Huxton Archonet Ltd