Re: interval's and printing...

Lists: pgsql-hackers
From: Larry Rosenman <ler(at)lerctr(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: interval's and printing...
Date: 2003-06-21 21:07:10
Message-ID: 15210000.1056229630@lerlaptop.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Why does the interval type not print seconds when they are zero?

This leads to inconsistent reading of the information.

7.3.3:

ler=# select '13 minutes'::interval;
interval
----------
00:13
(1 row)

ler=# select '13 minutes 1 second'::interval;
interval
----------
00:13:01
(1 row)

ler=#

I noticed this when I loaded the data from my long distance company into
a PG database.

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: interval's and printing...
Date: 2003-06-21 22:27:57
Message-ID: 29778.1056234477@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Larry Rosenman <ler(at)lerctr(dot)org> writes:
> Why does the interval type not print seconds when they are zero?

Seems like a bug to me too. Anyone think it's not?

Note this only occurs with DateStyle = ISO, the other datestyles
use a different format for intervals.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Larry Rosenman <ler(at)lerctr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: interval's and printing...
Date: 2003-06-22 22:05:42
Message-ID: 200306222205.h5MM5go21457@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Larry Rosenman <ler(at)lerctr(dot)org> writes:
> > Why does the interval type not print seconds when they are zero?
>
> Seems like a bug to me too. Anyone think it's not?
>
> Note this only occurs with DateStyle = ISO, the other datestyles
> use a different format for intervals.

Clearly seems like a bug to me.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: interval's and printing...
Date: 2003-06-24 03:41:29
Message-ID: 200306240341.h5O3fTT16567@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Add to TODO:

* Have SELECT '13 minutes'::interval display zero seconds

---------------------------------------------------------------------------

Larry Rosenman wrote:
> Why does the interval type not print seconds when they are zero?
>
> This leads to inconsistent reading of the information.
>
> 7.3.3:
>
> ler=# select '13 minutes'::interval;
> interval
> ----------
> 00:13
> (1 row)
>
> ler=# select '13 minutes 1 second'::interval;
> interval
> ----------
> 00:13:01
> (1 row)
>
> ler=#
>
> I noticed this when I loaded the data from my long distance company into
> a PG database.
>
>
> --
> Larry Rosenman http://www.lerctr.org/~ler
> Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
> US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: interval's and printing...
Date: 2003-06-24 07:08:29
Message-ID: 20320000.1056438509@lerlaptop.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

--On Monday, June 23, 2003 23:41:29 -0400 Bruce Momjian
<pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:

>
> Add to TODO:
>
> * Have SELECT '13 minutes'::interval display zero seconds
you might want to clarify the TODO to include in ISO DateStyle.

(Per tom's comments).

LER

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: interval's and printing...
Date: 2003-06-24 13:46:33
Message-ID: 200306241346.h5ODkXv17856@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Larry Rosenman wrote:
> >
> > Add to TODO:
> >
> > * Have SELECT '13 minutes'::interval display zero seconds
> you might want to clarify the TODO to include in ISO DateStyle.
>
> (Per tom's comments).

Can you supply an example/text?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: interval's and printing...
Date: 2003-06-24 14:23:08
Message-ID: 3400000.1056464588@lerlaptop-red.iadfw.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

--On Tuesday, June 24, 2003 09:46:33 -0400 Bruce Momjian
<pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:

> Larry Rosenman wrote:
>> >
>> > Add to TODO:
>> >
>> > * Have SELECT '13 minutes'::interval display zero seconds
>> you might want to clarify the TODO to include in ISO DateStyle.
>>
>> (Per tom's comments).
>
> Can you supply an example/text?
* Have SELECT '13 minutes'::interval display zero seconds when using
DateStyle ISO

>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania
> 19073

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: interval's and printing...
Date: 2003-06-24 14:44:25
Message-ID: 200306241444.h5OEiP223895@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Larry Rosenman wrote:
> >> > * Have SELECT '13 minutes'::interval display zero seconds
> >> you might want to clarify the TODO to include in ISO DateStyle.
> >>
> >> (Per tom's comments).
> >
> > Can you supply an example/text?
> * Have SELECT '13 minutes'::interval display zero seconds when using
> DateStyle ISO

I am still confused. What does such output look like. Right now I
get:

test=> SELECT '13 minutes'::interval;
interval
----------
00:13
(1 row)

I assume the idea is to display it as 00:13:00, right?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: interval's and printing...
Date: 2003-06-24 14:50:20
Message-ID: 29380000.1056466220@lerlaptop-red.iadfw.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

--On Tuesday, June 24, 2003 10:44:25 -0400 Bruce Momjian
<pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:

> Larry Rosenman wrote:
>> >> > * Have SELECT '13 minutes'::interval display zero seconds
>> >> you might want to clarify the TODO to include in ISO DateStyle.
>> >>
>> >> (Per tom's comments).
>> >
>> > Can you supply an example/text?
>> * Have SELECT '13 minutes'::interval display zero seconds when using
>> DateStyle ISO
>
> I am still confused. What does such output look like. Right now I
> get:
>
> test=> SELECT '13 minutes'::interval;
> interval
> ----------
> 00:13
> (1 row)
>
> I assume the idea is to display it as 00:13:00, right?
Correct, but with Postgres DateStyle or SQL, it does other stuff:

$ psql
Welcome to psql 7.3.3, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

ler=# set datestyle='postgres'
ler-# ;
SET
ler=# select '13 minutes'::interval
ler-# ;
interval
-----------
@ 13 mins
(1 row)

ler=# set datestyle='sql';
SET
ler=# select '13 minutes'::interval;
interval
-----------
@ 13 mins
(1 row)

ler=# set datestyle='iso,us';
SET
ler=# select '13 minutes'::interval;
interval
----------
00:13
(1 row)

ler=#
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania
> 19073

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: interval's and printing...
Date: 2003-06-24 18:43:24
Message-ID: 200306241843.h5OIhO814410@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


TODO updated:

* Have SELECT '13 minutes'::interval display zero seconds in ISO
datestyle

---------------------------------------------------------------------------

Larry Rosenman wrote:
>
>
> --On Tuesday, June 24, 2003 10:44:25 -0400 Bruce Momjian
> <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
>
> > Larry Rosenman wrote:
> >> >> > * Have SELECT '13 minutes'::interval display zero seconds
> >> >> you might want to clarify the TODO to include in ISO DateStyle.
> >> >>
> >> >> (Per tom's comments).
> >> >
> >> > Can you supply an example/text?
> >> * Have SELECT '13 minutes'::interval display zero seconds when using
> >> DateStyle ISO
> >
> > I am still confused. What does such output look like. Right now I
> > get:
> >
> > test=> SELECT '13 minutes'::interval;
> > interval
> > ----------
> > 00:13
> > (1 row)
> >
> > I assume the idea is to display it as 00:13:00, right?
> Correct, but with Postgres DateStyle or SQL, it does other stuff:
>
> $ psql
> Welcome to psql 7.3.3, the PostgreSQL interactive terminal.
>
> Type: \copyright for distribution terms
> \h for help with SQL commands
> \? for help on internal slash commands
> \g or terminate with semicolon to execute query
> \q to quit
>
> ler=# set datestyle='postgres'
> ler-# ;
> SET
> ler=# select '13 minutes'::interval
> ler-# ;
> interval
> -----------
> @ 13 mins
> (1 row)
>
> ler=# set datestyle='sql';
> SET
> ler=# select '13 minutes'::interval;
> interval
> -----------
> @ 13 mins
> (1 row)
>
> ler=# set datestyle='iso,us';
> SET
> ler=# select '13 minutes'::interval;
> interval
> ----------
> 00:13
> (1 row)
>
> ler=#
> >
> > --
> > Bruce Momjian | http://candle.pha.pa.us
> > pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> > + If your life is a hard drive, | 13 Roberts Road
> > + Christ can be your backup. | Newtown Square, Pennsylvania
> > 19073
>
>
>
> --
> Larry Rosenman http://www.lerctr.org/~ler
> Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
> US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
>
>
>
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: interval's and printing...
Date: 2003-06-24 21:12:11
Message-ID: 58820000.1056489130@lerlaptop.iadfw.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

--On Tuesday, June 24, 2003 14:43:24 -0400 Bruce Momjian
<pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:

>
> TODO updated:
>
> * Have SELECT '13 minutes'::interval display zero seconds in ISO
> datestyle
>
I just posted a patch to -patches for this. (it's a quickie, even).

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749