Re: [ADMIN] need help to write a function in postgresql

2012-08-03 Thread Craig Ringer
On 08/03/2012 04:37 PM, Laszlo Nagy wrote: It is also better because with a view, you can also do " name is null ". But you cannot do that with a function (unless you write unnecessary circumstancial code.) While I agree with you on the view - among other things, it lets the query optimiser p

Re: [ADMIN] need help to write a function in postgresql

2012-08-03 Thread Laszlo Nagy
Then you can do: select * from retrieve_user('foo', 'bar'); Personally I'd prefer to create view that wraps that select statement and then simply do a select * from user_view where name = 'foo' and password = 'bar' It is also better because with a view, you can also d

Re: [ADMIN] need help to write a function in postgresql

2012-07-19 Thread Albe Laurenz
Madhu.Lanka wrote: > Can u please help to write a function for the following scenario? > "select [...] from [...] where [...] and p.name=? and p.password=?" Don't use "?" for the parameters. Use "$1" for the first parameter and "$2" for the second. Yours, Laurenz Albe -- Sent via pgsql-admin m

Re: [ADMIN] need help to write a function in postgresql

2012-07-19 Thread Thomas Kellerer
Madhu.Lanka, 19.07.2012 11:14: Hi Friends Can u please help to write a function for the following scenario? I have 3 table’s user_roles, principals and roles. I have to write a function in postgresql which should excepts 2 parameters (name, password) With those 2 parameters the query should

[ADMIN] need help to write a function in postgresql

2012-07-19 Thread Madhu.Lanka
Hi Friends Can u please help to write a function for the following scenario? I have 3 table's user_roles, principals and roles. I have to write a function in postgresql which should excepts 2 parameters (name, password) With those 2 parameters the query should be executed and return the r