Re: Selecting timestamp from Database

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
Cc: Richard Harley <richard(at)scholarpack(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Selecting timestamp from Database
Date: 2013-04-08 23:16:11
Message-ID: 51634FBB.7040400@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/08/2013 08:28 AM, Daniele Varrazzo wrote:
> On Mon, Apr 8, 2013 at 3:15 PM, Richard Harley <richard(at)scholarpack(dot)com> wrote:
>>
>> That returns nothings also. But I have spied the problem now:
>>
>> select ATTENDANCE.timestamp::text from attendance order by timestamp desc
>> limit 1
>>
>> return the actual timestamp: 2013-04-08 12:42:40.089952
>>
>> So the theory I'm wondering about is that the stored data in fact
>> contains (some values with) fractional seconds, but Richard's
>> client-side software isn't bothering to show those, misleading him
>> into entering values that don't actually match the stored data.
>> Looking at the table directly with psql would prove it one way
>> or the other.
>>
>> This is it. It was the psycopg adapter. My bad!!
>
> This message can be misread as psycopg dropping the fractional part of
> the timestamp, which is not the case:
>
> >>> cur.execute("select '2013-04-08 12:42:40.089952'::timestamp")
> >>> cur.fetchone()[0]
> datetime.datetime(2013, 4, 8, 12, 42, 40, 89952)
>
> Just FYI.

Well, pretty sure the returned results where getting massaged at some
point between pyscopg2 and the screen, only way I can figure timezone
information was turning up in non-timezone aware values.

>
> -- Daniele
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Kerr 2013-04-08 23:24:45 Re: AWS and postgres issues
Previous Message Tom Lane 2013-04-08 23:04:57 Re: Difference between Python and Postgres locale currency formats