Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 1B48E6322A1 for ; Sun, 13 Jun 2010 12:49:59 -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 77853-07 for ; Sun, 13 Jun 2010 15:49:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f46.google.com (mail-fx0-f46.google.com [209.85.161.46]) by mail.postgresql.org (Postfix) with ESMTP id C18F3632196 for ; Sun, 13 Jun 2010 12:49:51 -0300 (ADT) Received: by fxm8 with SMTP id 8so1989955fxm.19 for ; Sun, 13 Jun 2010 08:49:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.102.197.36 with SMTP id u36mr1296236muf.105.1276444190362; Sun, 13 Jun 2010 08:49:50 -0700 (PDT) Received: by 10.103.198.19 with HTTP; Sun, 13 Jun 2010 08:49:50 -0700 (PDT) In-Reply-To: <14107.1276443739@sss.pgh.pa.us> References: <4C119B3E.3090608@squeakycode.net> <12241.1276287655@sss.pgh.pa.us> <4C14746F.9050603@enterprisedb.com> <14107.1276443739@sss.pgh.pa.us> Date: Sun, 13 Jun 2010 17:49:50 +0200 Message-ID: Subject: Re: Analysis Function From: Magnus Hagander To: Tom Lane Cc: David Jarvis , Heikki Linnakangas , pgsql-performance Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201006/233 X-Sequence-Number: 39089 On Sun, Jun 13, 2010 at 17:42, Tom Lane wrote: > 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. =A0What > I think it shouldn't have is a default. =A0OTOH I see no good reason > not to allow the other ones to have defaults. =A0(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?) Umm. NULL could be made to mean that, or we could provicde two different versions - one that takes TZ and one that doesn't. >>> Similarly, to_timestamp() ...? Seems meaningless without at least a ful= l >>> 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). =A0When 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). And a third, construct_time(), no? --=20 Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/