Обсуждение: Timestamp Fractions Problem

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

Timestamp Fractions Problem

От
"Florian Mader"
Дата:
<div class="Section1"><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><font face="Courier
New"size="2"><span lang="EN-GB" style="font-size:10.0pt;mso-bidi-font-size: 
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">Hello,</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">I have got a really big problem with queries for
Timestamp-Values.</span></font><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><font
face="CourierNew" size="2"><span lang="EN-GB" style="font-size:10.0pt;mso-bidi-font-size: 
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"><span style="mso-tab-count:1">      </span>select mod_ from
TMODUL</span></font><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><font face="Courier
New"size="2"><span lang="EN-GB" style="font-size:10.0pt;mso-bidi-font-size: 
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">This query, sent to a DBII returns the value </span></font><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><font face="Courier New" size="2"><span
lang="EN-GB"style="font-size:10.0pt;mso-bidi-font-size: 
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"><span style="mso-tab-count:1">      </span>2002-09-11
17:47:30.017000</span></font><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><font
face="CourierNew" size="2"><span lang="EN-GB" style="font-size:10.0pt;mso-bidi-font-size: 
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">The same query sent to a PostgreSQL returns the
value</span></font><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><font face="Courier New"
size="2"><spanlang="EN-GB" style="font-size:10.0pt;mso-bidi-font-size: 
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"><span style="mso-tab-count:1">      </span>2002-09-11
</span></font><fontface="Courier New"><span lang="EN-GB" style="mso-bidi-font-size:10.0pt;font-family:"Courier
New";mso-ansi-language:EN-GB">17:47:30</span></font><fontface="Courier New"><span lang="EN-GB"
style="mso-bidi-font-size:10.0pt;font-family:"CourierNew"; 
mso-ansi-language:EN-GB"></span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">I know that the fractions are also stored in the PostgreSQL,
becausethe query</span></font><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><font
face="CourierNew" size="2"><span lang="EN-GB" style="font-size:10.0pt;mso-bidi-font-size: 
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"><span style="mso-tab-count:1">      </span><span
class="GramE">select</span>to_char(mod_, 'YYYY-MM-DD HH24:MI:SS.US') from TMODUL</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><font face="Courier New" size="2"><span
lang="EN-GB"style="font-size: 
10.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-ansi-language:
EN-GB">returns</span></font></span><font face="Courier New"><span lang="EN-GB"
style="mso-bidi-font-size:10.0pt;font-family:"CourierNew";mso-ansi-language: 
EN-GB"> also</span></font><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><font
face="CourierNew" size="2"><span lang="EN-GB" style="font-size:10.0pt;mso-bidi-font-size: 
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"><span style="mso-tab-count:1">      </span>2002-09-11
17:47:30.017000</span></font><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><font
face="CourierNew" size="2"><span lang="EN-GB" style="font-size:10.0pt;mso-bidi-font-size: 
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">What's the property I have to set, so that an ordinary
"selectmod_ from TMODUL" also returns fractions?</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">Platform Info</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">OS: Win2000</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">Emulator: cygWin</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">PostgreSQL: 7.2.1</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span lang="EN-GB"
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB">Does anybody have an idea?</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:DE">TIA</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:DE">Florian</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span
style="font-size:10.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-ansi-language:DE"> </span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanlang="DE-AT" style="font-size: 
10.0pt;mso-bidi-font-size:10.0pt;font-family:Arial"> </span></font></div>

Re: Timestamp Fractions Problem

От
Tom Lane
Дата:
"Florian Mader" <florian_mader@gmx.net> writes:
> I have got a really big problem with queries for Timestamp-Values.
>       select mod_ from TMODUL 
> This query, sent to a DBII returns the value 
>       2002-09-11 17:47:30.017000
> The same query sent to a PostgreSQL returns the value
>       2002-09-11 17:47:30

Around here I get

regression=# select mod_ from TMODUL ;
ERROR:  Relation "tmodul" does not exist

If I guess about what you meant then I get:

regression=# create table TMODUL(mod_ timestamp);
CREATE TABLE
regression=# insert into TMODUL values (now());
INSERT 1062096 1
regression=# select mod_ from TMODUL ;           mod_
----------------------------2002-09-13 23:33:53.516852
(1 row)

Perhaps you should be a tad more specific about how your table is
declared and what you are doing to put data into it.
        regards, tom lane

PS: could we also ask you to suppress HTML output from your mailer?


Re: Timestamp Fractions Problem

От
"Florian Mader"
Дата:
Thank you Tom for the reply!
Now I tried the same create, insert and select statement you did. But
the DB didn't return fractions like it did in your case. I only got this
mod_                
------------------- 
2002-09-14 10:45:32
I am using WinSQL and the ODBC Driver I found on
http://odbc.postgresql.org 
Are there any special settings needed for the ODBC Driver? They are
currently set to default. 
TIA Florian



Re: Timestamp Fractions Problem

От
Tom Lane
Дата:
"Florian Mader" <florian_mader@gmx.net> writes:
> Now I tried the same create, insert and select statement you did. But
> the DB didn't return fractions like it did in your case.

Hm, what PG version are you running?  You need 7.2 or later to have full
support for fractional timestamps (in particular, the result of now() is
only good to the nearest second in prior versions).
        regards, tom lane


Re: Timestamp Fractions Problem

От
"Florian Mader"
Дата:
I am using:
PostgreSQL 7.2.2
ODBC Driver 7.02.00.02
Cygwin 1.3.12-2
Win2000 5.00.2195 SP2
WinSQL 3.8.19.499

I don't think that there's a problem with my versions.
Do you have any other idea?
TIA

-----Ursprüngliche Nachricht-----
Von: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Gesendet: Sonntag, 15. September 2002 16:52
An: Florian Mader
Cc: pgsql-sql@postgresql.org
Betreff: Re: [SQL] Timestamp Fractions Problem

"Florian Mader" <florian_mader@gmx.net> writes:
> Now I tried the same create, insert and select statement you did. But
> the DB didn't return fractions like it did in your case.

Hm, what PG version are you running?  You need 7.2 or later to have full
support for fractional timestamps (in particular, the result of now() is
only good to the nearest second in prior versions).
        regards, tom lane