Re: problem with bytea and undecorated literals

Daniele Varrazzo <[email protected]> Wed, 5 May 2010 01:17:24 +0100
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Tue, May 4, 2010 at 6:36 PM, Michael Tharp <gxti-1pawZKhx9Om5WRpDikjj11aTQe2KTcn/@public.gmane.org> wrote:
> On 05/04/2010 04:23 AM, Daniele Varrazzo wrote:

>> so psycopg should decide which type to cast into according to the
>> tzinfo presence:
>
> Absolutely. Cast to the closest representation first, then let the user (or
> their column types) determine the final form.

I've implemented the datetime adapter as discussed in this thread.
Patches are available from the usual repo.

The patch is not for mx DateTime: from what I see, tz are not used at
all with those objects. Yesterday patches are for mx objects too
instead.

> The key to understanding timestamptz is that it *doesn't actually store the
> time zone* -- it is the same size as a timestamp. Postgres just converts to
> UTC on the way in, and back to your client's "timezone" setting on the way
> out.

Yes, this is a point I've already banged my head against (in ASN.1
area). I'm always inclined to think that a timestamp with tz carries
more informations than one without, storing something like a
"geographical location of the event"... well, not for postgres (nor in
canonical ASN.1 encoding), even if the string (or other non-canonical
representation) allows for it.

-- Daniele