Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 42710632196 for ; Sun, 13 Jun 2010 12:42:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 77142-04 for ; Sun, 13 Jun 2010 15:42:24 +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 3D55263199C for ; Sun, 13 Jun 2010 12:42:24 -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 o5DFgKBX014108; Sun, 13 Jun 2010 11:42:20 -0400 (EDT) To: Magnus Hagander cc: David Jarvis , Heikki Linnakangas , pgsql-performance Subject: Re: Analysis Function In-reply-to: References: <4C119B3E.3090608@squeakycode.net> <12241.1276287655@sss.pgh.pa.us> <4C14746F.9050603@enterprisedb.com> Comments: In-reply-to Magnus Hagander message dated "Sun, 13 Jun 2010 11:42:50 +0200" Date: Sun, 13 Jun 2010 11:42:19 -0400 Message-ID: <14107.1276443739@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.011 tagged_above=-10 required=5 tests=BAYES_20=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/232 X-Sequence-Number: 39088 Magnus Hagander writes: > On Sun, Jun 13, 2010 at 09:38, David Jarvis wrote: >> Does it makes sense to use named parameter notation for the first value (the >> year)? This could be potentially confusing: > How so? If it does named parameters, why not all? There's no reason not to allow the year parameter to be named. What I think it shouldn't have is a default. OTOH I see no good reason not to allow the other ones to have defaults. (We presumably want timezone to default to the system timezone setting, but I wonder how we should make that work --- should an empty string be treated as meaning that?) >> Similarly, to_timestamp() ...? Seems meaningless without at least a full >> date and an hour. > Agreed. No, I think it's perfectly sane to allow month/day to default to 1 and h/m/s to zeroes. I do think it might be a good idea to have two functions, construct_timestamp yielding timestamptz and construct_date yielding date (and needing only 3 args). When you only want a date, having to use construct_timestamp and cast will be awkward and much more expensive than is needed (timezone rotations aren't real cheap). regards, tom lane