Re: INTERVAL SECOND limited to 59 seconds?

From: Sebastien FLAESCH <sf(at)4js(dot)com>
To: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, mmoncure(at)gmail(dot)com
Subject: Re: INTERVAL SECOND limited to 59 seconds?
Date: 2009-06-08 07:20:29
Message-ID: 4A2CBBBD.6010703@4js.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

This is of course unexpected to me (one day becomes an hour)...

Actually I would even expect an error, because there are missing interval parts.

To represent a valid day to second interval, you should write '1 00:00:00' ...

'1' would be a valid day to day interval.

Always providing all interval units would clarify the user code (avoid complex
rules to get defaults), IMHO.

Just to compare with IFX interval literals:

==============================================================================

> select interval( 1, day to second ) from systables where tabid=1;

201: A syntax error has occurred.
Error in line 1
Near character position 37

> select interval( 1 ) day to second from systables where tabid=1;

1262: Non-numeric character in datetime or interval.
Error in line 1
Near character position 36

> select interval ( 1 11:22:33 ) day to second from systables where tabid=1;

(constant)

1 11:22:33

1 row(s) retrieved.

> select interval ( 1 ) day to day from systables where tabid=1;

(constant)

1

1 row(s) retrieved.

==============================================================================

Seb

Ron Mayer wrote:
> Finally got around to looking at this thread.
> Looks like the original questions from the thread
> got resolved, but I found this behaviour surprising:
>
> regression=# select interval '1' day to second;
> interval
> ----------
> @ 1 hour
> (1 row)
>
> Should this be 1 second?
> If so I can send a patch.
>
>
>
>
>
> regression=# select version();
> version
> -----------------------------------------------------------------------------------------------------------
> PostgreSQL 8.4beta2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3), 32-bit
> (1 row)
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Grzegorz Jaśkiewicz 2009-06-08 07:43:21 Re: Why lots of temp schemas are being created
Previous Message Gerhard Wiesinger 2009-06-08 06:35:20 Sum of multiplied deltas

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2009-06-08 07:24:50 Re: Simple, safe hot backup and recovery
Previous Message Robert Haas 2009-06-08 04:47:45 Re: pg_migrator issue with contrib