how to found a variable is in a aggregation or not? - Mailing list pgsql-general

From Yi Zhao
Subject how to found a variable is in a aggregation or not?
Date
Msg-id 1216120289.4051.25.camel@localhost.localdomain
Whole thread Raw
In response to Top N within groups?  (Klint Gore <kgore4@une.edu.au>)
Responses Re: how to found a variable is in a aggregation or not?
Re: how to found a variable is in a aggregation or not?
List pgsql-general
I want to check a variable is in a aggregattion or not, so I create a
function as below:

create or replace function anytest(val text) returns boolean as $$
begin
    perform 1 where quote_literal(val) in ('hello', 'world', 'test');
    if not found then
        return false;
    else
        return true;
    end if;
end;
$$ language plpgsql;

but when I used, I got the result below, why?

test=# select anytest('world111');
 anytest
---------
 f
(1 row)

test=# select anytest('world');
 anytest
---------
 f
(1 row)


any help is appreciated.

regards,
Zy


pgsql-general by date:

Previous
From: justin
Date:
Subject: Re: FAQ correction for Windows 2000/XP
Next
From: "Pavel Stehule"
Date:
Subject: Re: how to found a variable is in a aggregation or not?