From: | "Matt A(dot)" <survivedsushi(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Altering functions cast |
Date: | 2005-08-26 21:59:50 |
Message-ID: | 20050826215950.38153.qmail@web35205.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
We use NULLIF() for adding [1|0|null] according to the
evalution of nullif('x','') into boolean columns.
Where x is [1|0|null], which if it's an empty string
(x='') then we add NULL cause NULLIF says if '' == ''
then return NULL into boolean.
An example wrapper function for this with an integer
cast:
CREATE FUNCTION nullif_always_int(text) RETURNS
integer AS '
SELECT nullif($1,'''')::int;
' LANGUAGE SQL;
I was hoping I could do something simliar with
booleans if possible?
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2005-08-26 22:04:52 | Re: About "ERROR: must be *superuser* to COPY to or from a file" |
Previous Message | Jim C. Nasby | 2005-08-26 21:51:48 | Re: POSS. FEATURE REQ: "Dynamic" Views |