From: | "Ian Harding" <ianh(at)tpchd(dot)org> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | CAST(null as date)... |
Date: | 2002-06-18 22:12:06 |
Message-ID: | sd0f4e20.098@mail.tpchd.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I tried to create a function to return the string 'null' (without quotes, of course...) if the input was a zero length string, so I could use it in casting arguments to another function such as:
select myfunction(cast(nullifzls($maybeemptyvar) as date), cast(....));
However I have this dilemma. The return type from the nullifzls function is text. Text blows up the cast. Is there any way to make this work, or should I do something else?
plantest=# select cast(null as date);
?column?
----------
(1 row)
plantest=# select nullifzls('');
nullifzls
---------------
null
(1 row)
plantest=# select cast(nullifzls('') as date);
ERROR: Bad date external representation 'null'
plantest=# select cast(cast('null' as text) as date);
ERROR: Bad date external representation 'null'
Thanks...
Ian
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-06-18 22:13:19 | Re: circular REFERENCES |
Previous Message | Stephan Szabo | 2002-06-18 22:10:53 | Re: Highly obscure and erratic |