X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7EDB852EC0 for ; Tue, 26 Jul 2005 15:05:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01808-08 for ; Tue, 26 Jul 2005 18:05:29 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 7FCCC52CB6 for ; Tue, 26 Jul 2005 15:05:27 -0300 (ADT) Received: (qmail 19903 invoked from network); 26 Jul 2005 18:05:27 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 26 Jul 2005 18:05:27 -0000 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v733) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <298B1CAF-F26F-4B1B-93FA-545CE821ED2D@fastcrypt.com> Cc: , , , Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Timestamp weirdness Date: Tue, 26 Jul 2005 14:05:25 -0400 To: Kevin Grittner X-Mailer: Apple Mail (2.733) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/333 X-Sequence-Number: 13481 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 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 > >