X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id E38F79FB266 for ; Thu, 3 Aug 2006 13:59:09 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 91923-07 for ; Thu, 3 Aug 2006 16:58:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id E53939F931A for ; Thu, 3 Aug 2006 13:58:54 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from BAYC1-PASMTP05.bayc1.hotmail.com (bayc1-pasmtp05.bayc1.hotmail.com [65.54.191.165]) by svr4.postgresql.org (Postfix) with ESMTP id 00E985AFB1A for ; Thu, 3 Aug 2006 16:58:53 +0000 (GMT) Message-ID: X-Originating-IP: [69.156.216.182] X-Originating-Email: [racine_89@sympatico.ca] Received: from [192.168.123.156] ([69.156.216.182]) by BAYC1-PASMTP05.bayc1.hotmail.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.1830); Thu, 3 Aug 2006 09:58:51 -0700 Message-ID: <44D22B48.2000101@sympatico.ca> Date: Thu, 03 Aug 2006 12:58:48 -0400 From: Sylvain Racine User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Function not return zero record Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Aug 2006 16:58:52.0110 (UTC) FILETIME=[18E376E0:01C6B71E] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.384 tagged_above=0 required=5 tests=MSGID_FROM_MTA_HEADER, SPF_SOFTFAIL X-Spam-Level: * X-Archive-Number: 200608/27 X-Sequence-Number: 25985 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? I run Postgresql 7.4 on i686-pc-cygwin (Windows XP), with PostGIS 1.0. CREATE TABLE adresses ( id int4 PRIMARY KEY DEFAULT nextval('seq_adresse'), ); SELECT AddGeometryColumn('greffe1','adresses','geom', 4269, 'POINT', 2); CREATE TYPE getCache AS (id integer,geocode double precision ARRAY[2]); CREATE FUNCTION getCache(varchar) RETURNS getCache AS ' SELECT id, ARRAY[x(geom),y(geom)] FROM adresses where adresse = $1; ' LANGUAGE sql; Best regards Sylvain Racine