Re: [GENERAL] Does Postgres supoort this type?
От | José Soares |
---|---|
Тема | Re: [GENERAL] Does Postgres supoort this type? |
Дата | |
Msg-id | 37172CA7.6369B360@sferacarta.com обсуждение исходный текст |
Ответ на | Does Postgres supoort this type? (Brian <signal@shreve.net>) |
Список | pgsql-general |
Use this: --iif(expr,par1,par2): returns par1 if expr is true otherwise returns par2 drop function iif(bool,text,text); create function iif(bool,text,text) returns text as ' begin IF $1 THEN RETURN $2; ELSE RETURN $3; END IF; end; ' language 'plpgsql'; select iif('true','verdad','mentira'); select iif(1=1,'verdad','mentira'); select iif(2=1,'verdad','mentira'); select iif(2>1,'verdad','mentira'); select iif(2<1,'verdad','mentira'); José Brian ha scritto: > Does postgres support queries of type: > > update table set foo=$bar,baz= if(goober is null, 1, goober+1); > > If so, what is the correct syntax? I was unable to find anything in the > Postgres html documentation. > > ----------------------------------------------------- > Brian Feeny (BF304) signal@shreve.net > 318-222-2638 x 109 http://www.shreve.net/~signal > Network Administrator ShreveNet Inc. (ASN 11881)
В списке pgsql-general по дате отправления: