pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sylvain Racine <syracine@sympatico.ca>
To: pgsql-sql@postgresql.org
Subject: Function not return zero record
Date: Thu, 03 Aug 2006 12:58:48 -0400
Message-ID: <BAYC1-PASMTP0542B98360BDDF31F757D8FD530@CEZ.ICE> (raw)

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




view thread (2+ messages)  latest in thread

Message-ID: <BAYC1-PASMTP0542B98360BDDF31F757D8FD530@CEZ.ICE>
Permalink:  ../BAYC1-PASMTP0542B98360BDDF31F757D8FD530@CEZ.ICE/
Also on:    postgresql.org/message-id/BAYC1-PASMTP0542B98360BDDF31F757D8FD530@CEZ.ICE

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: syracine@sympatico.ca
  Subject: Re: Function not return zero record
  In-Reply-To: <BAYC1-PASMTP0542B98360BDDF31F757D8FD530@CEZ.ICE>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox