Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id BC99263244D for ; Tue, 19 May 2009 05:54:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 26291-07 for ; Tue, 19 May 2009 05:54:25 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from relay.ptn-ipout01.plus.net (relay.ptn-ipout01.plus.net [212.159.7.35]) by mail.postgresql.org (Postfix) with ESMTP id 5B0AE6322F3 for ; Tue, 19 May 2009 05:54:30 -0300 (ADT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAEsQEkrUnw6S/2dsb2JhbADOG4QBBQ Received: from ptb-relay02.plus.net ([212.159.14.146]) by relay.ptn-ipout01.plus.net with ESMTP; 19 May 2009 09:53:20 +0100 Received: from [84.51.143.99] (helo=server3.office.archonet.com) by ptb-relay02.plus.net with esmtp (Exim) id 1M6L4a-0002Vi-1y; Tue, 19 May 2009 09:53:20 +0100 Received: from dell36.office.archonet.com (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id CA988274049; Tue, 19 May 2009 09:53:19 +0100 (BST) Message-ID: <4A12737F.1020207@archonet.com> Date: Tue, 19 May 2009 09:53:19 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Sebastien FLAESCH CC: pgsql-general@postgresql.org, mmoncure@gmail.com Subject: Re: INTERVAL SECOND limited to 59 seconds? References: <4A127038.3010103@4js.com> In-Reply-To: <4A127038.3010103@4js.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: d6d2346126edc7636abfc301a5fa7937 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200905/621 X-Sequence-Number: 147759 Sebastien FLAESCH wrote: > Hello, > > Can someone explain this: > > test1=> create table t1 ( k int, i interval second ); > CREATE TABLE > test1=> insert into t1 values ( 1, '-67 seconds' ); > INSERT 0 1 > test1=> insert into t1 values ( 2, '999 seconds' ); > INSERT 0 1 > test1=> select * from t1; > k | i > ---+----------- > 1 | -00:00:07 > 2 | 00:00:39 > (2 rows) > > I would expect that an INTERVAL SECOND can store more that 59 seconds. I didn't even know we had an "interval second" type. It's not entirely clear to me what such a value means. Anyway - what's happening is that it's going through "interval" first. So - '180 seconds' will yield '00:03:00' and the seconds part of that is zero. The question I suppose is whether that's correct or not. An interval can clearly store periods longer than 59 seconds. It's reasonable to ask for an interval to be displayed as "61 seconds". If "interval second" means the seconds-only part of an interval though, then it's doing the right thing. -- Richard Huxton Archonet Ltd