Обсуждение: BUG #4935: Weird input syntax for intervals, part 2

Поиск
Список
Период
Сортировка

BUG #4935: Weird input syntax for intervals, part 2

От
"Frank Spies"
Дата:
The following bug has been logged online:

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

After finding out that bug #4918 was already fixed in 8.4 release, I played
around with the interval input syntax in 8.4 and found that
'2.5' year
is not the same as
'2.5 year'
in release 8.4:

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

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

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

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

(I posted this already as reply to bug 4918, but nobody answered, probably
because the problem was already resolved)

Re: BUG #4935: Weird input syntax for intervals, part 2

От
Tom Lane
Дата:
"Frank Spies" <frank.spies@biotronik.com> writes:
> After finding out that bug #4918 was already fixed in 8.4 release, I played
> around with the interval input syntax in 8.4 and found that
> '2.5' year
> is not the same as
> '2.5 year'
> in release 8.4:

I don't think this is a bug.  The former case specifies (per SQL
standard) that you are only wanting storage to year accuracy.
The latter is a historical Postgres syntax that does not involve
constraining the precision of the stored value.

            regards, tom lane