IFNULL - problem
От | Albert REINER |
---|---|
Тема | IFNULL - problem |
Дата | |
Msg-id | 19990926172837.A261@frithjof обсуждение исходный текст |
Ответы |
Re: [SQL] IFNULL - problem
|
Список | pgsql-sql |
Hi, I'm using PostgreSQL 6.5.1, and when I try to use IFNULL (listed in the SQL Functions section of the docs in /doc.html/user/functions.htm#AEN2121, as: Table 5-1. SQL Functions Function Returns Description Example ... IFNULL(input,non-NULL substitute) non-NULL returnsecond argument if first is NULL IFNULL(c1, 'N/A') ... ), psql complains about not knowing such a function: albert=> select ifnull(NULL, 'ASDF'); ERROR: No such function 'ifnull' with the specified attributes albert=> select ifnull(1, 2); ERROR: No such function 'ifnull' with the specified attributes What I really want to do is something like: albert=> \d mailcalendar Table = mailcalendar +----------------------------------+----------------------------------+-------+ | Field | Type | Length| +----------------------------------+----------------------------------+-------+ | base | datetime | 8 | | repeat | reltime | 4 | | offs | reltime | 4 | | next | datetime | 8 | | mail | text | var | +----------------------------------+----------------------------------+-------+ albert=> select ifnull(next, base) as asdf from mailcalendar; ERROR: No such function 'ifnull' with the specified attributes What's wrong here? Am I just misusing this feature, or is it really missing? I know that I can work around it by using case, but this is a bit less convenient. albert=> select case when next is null then base else next end as asdf from mailcalendar; asdf ---------------------------- Sun Sep 26 00:00:00 1971 MET (1 row) Albert. -- --------------------------------------------------------------------------- Post an / Mail to / Skribu al: Albert Reiner<areiner@tph.tuwien.ac.at> ---------------------------------------------------------------------------
В списке pgsql-sql по дате отправления: