Postgres Function poser

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

Postgres Function poser

Postby pk_fox » Sun Jun 08, 2014 1:13 pm

Hi all, I created the function below in postgresql 9.3 on a Windows box and it worked as expected however I've now moved over to using postgres on a Debian wheezy box and my parameter @id seems to be being ignored as no matter what value I pass in the function returns all the records BUT ? if I use $1 instead of @id the function works as expected - is this a Linux thing ? I'm pretty sure I ran this query on a Raspberry pi and it worked using @id and the pi has Debian on it - any ideas ?


Code: Select all
FUNCTION spgetallclients("@id" integer) RETURNS SETOF clients AS
$BODY$SELECT id, clientname, addressline1, addressline2, addressline3, postcode,
       hometelephone,  businesstelephone, mobile, emailpersonal, emailbusiness,
       businesstype
  FROM clients
  where
case when @id = -1
then id > @id
else id = @id
end
We can't stop here, this is bat country. Hunter S Thompson RIP.
User avatar
pk_fox
LXF regular
 
Posts: 294
Joined: Wed Apr 13, 2005 1:38 pm
Location: Surrey, UK

Return to Help!

Who is online

Users browsing this forum: Google [Bot] and 2 guests