Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 99933B5DCD1 for ; Wed, 13 Jul 2011 18:22:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 51618-05 for ; Wed, 13 Jul 2011 21:22:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 6DAB8B5DC48 for ; Wed, 13 Jul 2011 18:22:38 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p6DLMa9e010834; Wed, 13 Jul 2011 17:22:36 -0400 (EDT) To: Robert Haas cc: Bruce Momjian , Daniele Varrazzo , PostgreSQL-development Subject: Re: [BUGS] extract(epoch from infinity) is not 0 In-reply-to: References: <201107131843.p6DIh8923252@momjian.us> Comments: In-reply-to Robert Haas message dated "Wed, 13 Jul 2011 15:13:12 -0500" Date: Wed, 13 Jul 2011 17:22:36 -0400 Message-ID: <10833.1310592156@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201107/697 X-Sequence-Number: 191796 Robert Haas writes: > On Jul 13, 2011, at 1:43 PM, Bruce Momjian wrote: >> I see: >> >> if (TIMESTAMP_NOT_FINITE(timestamp)) >> { >> result = 0; >> PG_RETURN_FLOAT8(result); >> } >> >> Does anyone object to changing this? > It's sort of non-obvious that either behavior is better than the other. We might just be replacing one surprising behavior with another. Well, this code path is not much except a punt. If we're going to touch it we should think through the behavior for all field types, not just epoch. I think a reasonable case could be made for throwing error or returning NaN (indicating "indeterminate") for most field types. I can see returning +/- infinity for epoch --- are there any others where that's sane? regards, tom lane