CAST(null as date)...
| От | Ian Harding |
|---|---|
| Тема | CAST(null as date)... |
| Дата | |
| Msg-id | sd0f4e20.098@mail.tpchd.org обсуждение исходный текст |
| Ответы |
Re: CAST(null as date)...
|
| Список | 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
anyway 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
В списке pgsql-general по дате отправления: