Thread: BUG #4918: Weird input syntax for intervals

BUG #4918: Weird input syntax for intervals

From
"Frank Spies"
Date:
The following bug has been logged online:

Bug reference:      4918
Logged by:          Frank Spies
Email address:      frank.spies@biotronik.com
PostgreSQL version: 8.4
Operating system:   Linux
Description:        Weird input syntax for intervals
Details:

It feels totally weird that the two queries

1) select interval '13 month'
2) select interval '13' month

do not have the same result: result for 1) is "1 year 1 mon", result for 2
is "1 mon". Is this correct behaviour?

Re: BUG #4918: Weird input syntax for intervals

From
Tom Lane
Date:
"Frank Spies" <frank.spies@biotronik.com> writes:
> It feels totally weird that the two queries
> 1) select interval '13 month'
> 2) select interval '13' month
> do not have the same result: result for 1) is "1 year 1 mon", result for 2
> is "1 mon". Is this correct behaviour?

$ psql
psql (8.4.0)
Type "help" for help.

regression=# select interval '13 month';
   interval
--------------
 1 year 1 mon
(1 row)

regression=# select interval '13' month;
   interval
--------------
 1 year 1 mon
(1 row)

You sure you are on 8.4.0?  We were fooling with the interval input code
quite late in 8.4 beta.

            regards, tom lane

Re: BUG #4918: Weird input syntax for intervals

From
Frank Spies
Date:
Hi Tom,

you are right, it's an RC I was running on.

Sorry...

Frank





www.biotronik.com




BIOTRONIK GmbH & Co. KG
Woermannkehre 1, 12359 Berlin, Germany
Sitz der Gesellschaft: Berlin, Registergericht: Berlin HRA 6501

Vertreten durch ihre Komplement=E4rin:
BIOTRONIK Mess- und Therapieger=E4te GmbH
Sitz der Gesellschaft: Berlin, Registergericht: Berlin HRB 2918
Gesch=E4ftsf=FChrer: Dr. Max Schaldach, Christoph B=F6hmer, Dr. Werner Brau=
n,=20
Dr. Lothar Krings


This email and the information it contains including attachments are=20
confidential and meant only for use by the intended recipient(s);=20
disclosure or copying is strictly prohibited. If you are not addressed,=20
but in the possession of this email, please notify the sender immediately=
=20
and delete the document.

Re: BUG #4918: Weird input syntax for intervals

From
Frank Spies
Date:
Hi,

I played a bit with the interval syntax and found this, this time on a 8.4=
=20
release:

psql -ddb_frank
psql (8.4.0)
Type "help" for help.

db_frank=3D#  select interval '2.5' year;
 interval
----------
 2 years
(1 row)

db_frank=3D#  select interval '2.5 year';
    interval
----------------
 2 years 6 mons
(1 row)

db_frank=3D# select version();
                                                   version
---------------------------------------------------------------------------=
----------------------------------
 PostgreSQL 8.4.0 on x86_64-pc-linux-gnu, compiled by GCC gcc-4.3.real=20
(Ubuntu 4.3.3-5ubuntu4) 4.3.3, 64-bit
(1 row)



www.biotronik.com




BIOTRONIK GmbH & Co. KG
Woermannkehre 1, 12359 Berlin, Germany
Sitz der Gesellschaft: Berlin, Registergericht: Berlin HRA 6501

Vertreten durch ihre Komplement=E4rin:
BIOTRONIK Mess- und Therapieger=E4te GmbH
Sitz der Gesellschaft: Berlin, Registergericht: Berlin HRB 2918
Gesch=E4ftsf=FChrer: Dr. Max Schaldach, Christoph B=F6hmer, Dr. Werner Brau=
n,=20
Dr. Lothar Krings


This email and the information it contains including attachments are=20
confidential and meant only for use by the intended recipient(s);=20
disclosure or copying is strictly prohibited. If you are not addressed,=20
but in the possession of this email, please notify the sender immediately=
=20
and delete the document.