Received: from frithjof.reiner (qmailr@a73.dialin.tuwien.ac.at [192.35.240.83]) by hub.org (8.9.3/8.9.3) with SMTP id OAA47020 for ; Sun, 26 Sep 1999 14:36:22 -0400 (EDT) (envelope-from areiner@tph.tuwien.ac.at) Received: (qmail 274 invoked by uid 500); 26 Sep 1999 15:28:37 -0000 From: "Albert REINER" Date: Sun, 26 Sep 1999 17:28:37 +0200 To: PostgreSQL-SQL Subject: IFNULL - problem Message-ID: <19990926172837.A261@frithjof> Mail-Followup-To: PostgreSQL-SQL Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i 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 return second 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 ---------------------------------------------------------------------------