Re: [GENERAL] how to found a variable is in a aggregation or not?

2008-07-15 Thread Yi Zhao
yes It's better obviously, thanks:D Yi On Tue, 2008-07-15 at 15:46 +0200, Pavel Stehule wrote: > so this code is little bit ugly > > you can write faster code > > create or replace function anytest(val text) > returns boolean as $$ > begin > return val in ('hello', 'world','test'); > en

Re: [GENERAL] how to found a variable is in a aggregation or not?

2008-07-15 Thread Pavel Stehule
so this code is little bit ugly you can write faster code create or replace function anytest(val text) returns boolean as $$ begin return val in ('hello', 'world','test'); end; $$ language plpgsql immutable strict; Pavel 2008/7/15 Yi Zhao <[EMAIL PROTECTED]>: > I want to check a variable is i

Re: [GENERAL] how to found a variable is in a aggregation or not?

2008-07-15 Thread Yi Zhao
it's works, thanks a lot! regards, Yi On Tue, 2008-07-15 at 13:30 +0200, Pavel Stehule wrote: > Hello > > in this case you must not use quoting > > postgres=# create or replace function anytest(val text) returns boolean as $$ > begin >perform 1 where val in ('hello', 'world', 'test'); >

Re: [GENERAL] how to found a variable is in a aggregation or not?

2008-07-15 Thread Pavel Stehule
Hello in this case you must not use quoting postgres=# create or replace function anytest(val text) returns boolean as $$ begin perform 1 where val in ('hello', 'world', 'test'); if not found then return false; else return true; end if; en

[GENERAL] how to found a variable is in a aggregation or not?

2008-07-15 Thread Yi Zhao
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;