dbTalk Databases Forums  

[BUGS] Interval resolution

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Interval resolution in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Geert Jansen
 
Posts: n/a

Default [BUGS] Interval resolution - 01-17-2005 , 12:21 PM







-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm running PostgreSQL 7.4.6 on RHEL 4 Beta 2. There seems to be a
bug, or call it inconsistentcy with the documentation, in the
interval data type. According to
http://www.postgresql.org/docs/7.4/s...-datetime.html, the
resolution of interval is 1 microsecond with a range from -178000000
to 178000000 years. In the example below, this resolution is not
provided:

<quote>
geertj@greet:~> psql
Welcome to psql 7.4.6, 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

geertj=> create table test (iv interval);
CREATE TABLE
geertj=> insert into test values ('701868 days, 1:26:00.685041');
INSERT 22447 1
geertj=> select * from test;
iv
- --------------------------------
701868 days 01:26:00.685043335
(1 row)
</quote>

As you can see, there's an error of 2 microseconds. After a bit of
experimentation I've noticed that the error becomes larger when the
interval becomes bigger.

Now I don't know if this is a serious bug, and I only found it when
doing unit testing with random data. However, it is an inconsistency
with the documentation that states microsecond resolution is provided
over the entire range.

Regards,
Geert Jansen

- --
Geert Jansen <geert (AT) boskant (DOT) nl>
PGP fingerprint: 97FA CE01 F760 4FA9 A0EC F7F9 9ACF 9153 95E2 50E0

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3

iQEVAwUBQepBZZrPkVOV4lDgAQJB8Af/UzpzMZMX6rwl1oaaezPuku/FU3MSCyzV
6mUMzeP3ACZ5tTnWs6tQcb0gvEA6+ckaX2UkGFRP/NZc6xdpmUKVE/8K9/h/y/Vf
t+XweyOfm3VUVHbxCaSuruuVn1kH9+zWaUS2NDB/+EwJ6ooZFfrBT8233pReNUCM
1r21Nx2koz4rODNugopeBiF9FwzcgJFcOpSlU1Hh3uYh/quSD3t0P4rVMzdRnqm3
r5FoRiMgfSefrFo0lDm9Kkw7QLi5e8chXgzrkTAZknkU9CcOb0 D8/h6pdo2upyXI
8tCj2DQBvb4ZMDDs0YlZOxlFzIej5SQsEonobWXNLYvxUXJS0b sEbg==
=fauh
-----END PGP SIGNATURE-----


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Interval resolution - 01-17-2005 , 12:38 PM






"Geert Jansen" <geert (AT) boskant (DOT) nl> writes:
Quote:
I'm running PostgreSQL 7.4.6 on RHEL 4 Beta 2. There seems to be a
bug, or call it inconsistentcy with the documentation, in the
interval data type. According to
http://www.postgresql.org/docs/7.4/s...-datetime.html, the
resolution of interval is 1 microsecond with a range from -178000000
to 178000000 years. In the example below, this resolution is not
provided:
See the NOTE below the table. The documentation does need improvement:
it only discusses precision for timestamp, without making it clear that
this applies to time and interval as well.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.