From: | Nick Thuesen <jimmy(dot)mcshaw(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Selects in Function Return Wrong Value |
Date: | 2005-04-10 09:48:00 |
Message-ID: | 77b0d6c60504100248485f77d2@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I'm glad there is a novice mailing list because I've spent to much
time in MSSQL and trying to figure out postgres is very frustrating.
Here's my prob.
I've created a function that uses the 'event' table.
CREATE OR REPLACE FUNCTION "public"."event_select_on_id" (event_id
integer) RETURNS "public"."event" AS
$body$
DECLARE
return_event public.event;
BEGIN
SELECT * INTO return_event FROM event WHERE event_id = $1;
RETURN return_event;
END;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
This was suppose to be a test function so I could get the feeling for
postgres but no matter what value I pass in it always returns the
first item in the table. This happens even if I pass in an id that
doesn't exists. I scanned through the archives for a while and can't
figure out what I'm doing wrong. Thanks in advance for helping a
noob.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2005-04-11 03:44:01 | Re: ecpg for windows |
Previous Message | Bob Henkel | 2005-04-10 00:54:17 | Re: Not quite managing my first join |