On Fri, Jan 23, 2009 at 06:32:17PM +0300, Igor Katson wrote:
> Sam, I'm not sure if this is correct to do that, as you I don't want to
> remember what will happen, if you use NULL = NULL or upper(NULL) etc.:
>
> WHERE
>COALESCE(city_id = i_city_id, TRUE) AND
>COALESCE(edu_id = i_edu_id,
Michael Glaesemann wrote:
On Jan 23, 2009, at 10:11 , Igor Katson wrote:
That one is awesome, thanks, I completely forgot about CASE
statement. The search func now looks as follows, and works perfectly:
CREATE OR REPLACE FUNCTION isocial_user_func.search_users
(i_city_id int, i_edu_id int, i
On Jan 23, 2009, at 10:11 , Igor Katson wrote:
That one is awesome, thanks, I completely forgot about CASE
statement. The search func now looks as follows, and works perfectly:
CREATE OR REPLACE FUNCTION isocial_user_func.search_users
(i_city_id int, i_edu_id int, i_firstname text, i_lastnam
Sam Mason wrote:
On Fri, Jan 23, 2009 at 02:16:34PM +0300, Igor Katson wrote:
a) If the input argument is NULL, then the corresponding select
statement will change from
column = arg
to
column IS NULL
I think you want to use the IS [NOT] DISTINCT FROM operator. It
works like the = an
On Fri, Jan 23, 2009 at 02:16:34PM +0300, Igor Katson wrote:
> a) If the input argument is NULL, then the corresponding select
> statement will change from
>
> column = arg
> to
> column IS NULL
I think you want to use the IS [NOT] DISTINCT FROM operator. It
works like the = and <> operators. i
2009/1/23, Igor Katson :
> I have a row search function, smth like
>
> CREATE OR REPLACE FUNCTION user_func.search_users
> (i_city_id int, i_edu_id int, i_first_name text, i_last_name text,
> limit_ int, offset_ int) RETURNS SETOF user.user AS $$
> . SELECT * FROM user WHERE
> city_id = i
Raymond O'Donnell wrote:
On 23/01/2009 11:16, Igor Katson wrote:
How do I write a function without complex logic, which will do:
a) If the input argument is NULL, then the corresponding select
statement will change from
column = arg
to
column IS NULL
You could build your statement dy
On 23/01/2009 11:16, Igor Katson wrote:
> How do I write a function without complex logic, which will do:
> a) If the input argument is NULL, then the corresponding select
> statement will change from
>
> column = arg
> to
> column IS NULL
You could build your statement dynamically as a string,
I have a row search function, smth like
CREATE OR REPLACE FUNCTION user_func.search_users
(i_city_id int, i_edu_id int, i_first_name text, i_last_name text,
limit_ int, offset_ int) RETURNS SETOF user.user AS $$
. SELECT * FROM user WHERE
city_id = i_city_id
...
$$ language plpgsql;
How