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)
>