Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 7A058632566 for ; Fri, 11 Jun 2010 17:21:07 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 88427-08 for ; Fri, 11 Jun 2010 20:21:00 +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 B58F563249C for ; Fri, 11 Jun 2010 17:20:57 -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 o5BKKtNa012242; Fri, 11 Jun 2010 16:20:55 -0400 (EDT) To: David Jarvis cc: pgsql-performance@postgresql.org Subject: Re: Analysis Function In-reply-to: References: <4C119B3E.3090608@squeakycode.net> Comments: In-reply-to David Jarvis message dated "Fri, 11 Jun 2010 11:17:18 -0700" Date: Fri, 11 Jun 2010 16:20:55 -0400 Message-ID: <12241.1276287655@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/218 X-Sequence-Number: 39074 David Jarvis writes: > dateserial(PG_FUNCTION_ARGS) { > int32 p_year = (int32)PG_GETARG_FLOAT8(0); > int32 p_month = PG_GETARG_INT32(1); > int32 p_day = PG_GETARG_INT32(2); Er ... why float? Integer is plenty for the range of years supported by the PG datetime infrastructure. The above coding is pretty lousy in terms of its roundoff and overflow behavior, too. regards, tom lane