pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Sebastien FLAESCH <sf@4js.com>
Cc: pgsql-general@postgresql.org
Cc: mmoncure@gmail.com
Subject: Re: INTERVAL SECOND limited to 59 seconds?
Date: Tue, 19 May 2009 09:53:19 +0100
Message-ID: <4A12737F.1020207@archonet.com> (raw)
In-Reply-To: <4A127038.3010103@4js.com>
References: <4A127038.3010103@4js.com>

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



view thread (8+ messages)  latest in thread

Message-ID: <4A12737F.1020207@archonet.com>
Permalink:  ../4A12737F.1020207@archonet.com/
Also on:    postgresql.org/message-id/4A12737F.1020207@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: dev@archonet.com, sf@4js.com, pgsql-general@postgresql.org, mmoncure@gmail.com
  Subject: Re: INTERVAL SECOND limited to 59 seconds?
  In-Reply-To: <4A12737F.1020207@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox