Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Postgres Function poser

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help!
View previous topic :: View next topic  
Author Message
pk_fox
LXF regular


Joined: Wed Apr 13, 2005 2:38 pm
Posts: 292
Location: Surrey, UK

PostPosted: Sun Jun 08, 2014 2:13 pm    Post subject: Postgres Function poser Reply with quote

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:

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.
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help! All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast