pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: oliver@opencloud.com
Cc: emergency.shower@gmail.com
Cc: pgsql-jdbc@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: Timestamp weirdness
Date: Tue, 26 Jul 2005 14:05:25 -0400
Message-ID: <298B1CAF-F26F-4B1B-93FA-545CE821ED2D@fastcrypt.com> (raw)
In-Reply-To: <s2e631c3.023@gwmta.wicourts.gov>
References: <s2e631c3.023@gwmta.wicourts.gov>


On 26-Jul-05, at 1:51 PM, Kevin Grittner wrote:

> Hi Oliver,
>
> You're saying that a timestampz read from the protocol stream on the
> server side is always parsed into a TIMESTAMP WITH TIME ZONE.  When it
> is assigned to a TIMESTAMP WITHOUT TIME ZONE, there is a cast.  The  
> cast
> converts the moment into the local time string for that moment in the
> time zone of the database server.  I get that.
>
> My question (not well stated, I'm sure) was whether there is a way to
> know, on the server, at the point of handling the timestampz from the
> protocol stream, that it is going to be assigned to a TIMESTAMP  
> WITHOUT
> TIME ZONE and use literal assignment rules (i.e., ignore the time zone
> info) instead of the cast rules.  The next question was whether this
> would break existing code.
Sort of.... postgres has automatic casting rules, if you tell it that  
it is going to be a timestamptz and
it is being assigned to a timestamp then there is a cast function  
which is invoked, and vice versa
>
> It sounds like you're well along on another solution, so this becomes
> acedemic.  I'm not sure how you're inferring a type with your  
> approach,
> but I guess I was thinking that it might be possible to infer
> alternative types for a timestampz.
He is telling the server that he doesn't know what the type is  
(INVALID) and the server is going
to cast it appropriately. Much like you do if you do "insert into foo  
values('2005-01-01 03:15:34')


>
> I'm new to PostgreSQL, so I appreciate the patience of those who are
> intimately familiar with the code.  It's takes quite a while to scan
> through source code and infer it all.  I'm hoping to gain a firm  
> enough
> understanding to contribute to the code without too many missteps.
>
> -Kevin
>
>
>
>>>> Oliver Jowett <oliver@opencloud.com> 07/26/05 9:20 AM >>>
>>>>
> Kevin Grittner wrote:
>
>
>> I assume that the behavior of the server when receiving a timestampz
>> within the protocol couldn't be changed to match the handling of a
>> literal without breaking significant existing code.
>>
>
> (One more time!)
>
> The parsing of timestamptz is just fine, it's the cast to timestamp  
> that
> breaks things.
>
> If we get the server to infer a type for the parameter rather than
> explicitly specifying it as timestamptz, then we can avoid that cast.
> Then things don't break.
>
> -O
>
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq
>
>




view thread (20+ messages)  latest in thread

Message-ID: <298B1CAF-F26F-4B1B-93FA-545CE821ED2D@fastcrypt.com>
Permalink:  ../298B1CAF-F26F-4B1B-93FA-545CE821ED2D@fastcrypt.com/
Also on:    postgresql.org/message-id/298B1CAF-F26F-4B1B-93FA-545CE821ED2D@fastcrypt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pg@fastcrypt.com, Kevin.Grittner@wicourts.gov, oliver@opencloud.com, emergency.shower@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Timestamp weirdness
  In-Reply-To: <298B1CAF-F26F-4B1B-93FA-545CE821ED2D@fastcrypt.com>
  References: <s2e631c3.023@gwmta.wicourts.gov> <298B1CAF-F26F-4B1B-93FA-545CE821ED2D@fastcrypt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox