Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 89847 invoked from network); 5 Apr 2010 20:00:49 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Apr 2010 20:00:49 -0000 Received: (qmail 62139 invoked by uid 500); 5 Apr 2010 20:00:49 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 62033 invoked by uid 500); 5 Apr 2010 20:00:49 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 62026 invoked by uid 99); 5 Apr 2010 20:00:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Apr 2010 20:00:49 +0000 X-ASF-Spam-Status: No, hits=-1219.9 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Apr 2010 20:00:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 08AD6234C48D for ; Mon, 5 Apr 2010 20:00:28 +0000 (UTC) Message-ID: <881855641.695861270497628034.JavaMail.jira@brutus.apache.org> Date: Mon, 5 Apr 2010 20:00:28 +0000 (UTC) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-2602) TIMESTAMP value is truncated when return to client In-Reply-To: <17010421.1178134635553.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-2602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12853519#action_12853519 ] Rick Hillegas commented on DERBY-2602: -------------------------------------- The Derby timestamp data type is simply a JDBC timestamp, that is, a java.sql.Timestamp. The header comment on that class indicates that it was created for the express purpose of allowing timestamps to have nanosecond precision. The SQL Standard does not impose any limitation on the precision of timestamps, leaving the issue to the implementer. The relevant sections of the Standard are part 2, section 4.6 (Datetimes and intervals) and part 2, section 5.3 (). The embedded driver supports the full range of timestamp values allowed by JDBC. In contrast, the network driver limits timestamps to microsecond precision. This truncation occurs both when timestamps pass from the client to the server and also in the reverse direction. I believe that that is the limit imposed by DB2; see http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.intro/db2z_datetimetimestamp.htm The microsecond limit is also enforced by Derby's builtin TIMESTAMP() function; see the header comment for SQLTimestamp.parseDateOrTimestamp(), which notes that an exception is raised if the argument to TIMESTAMP() "is incorrect for an IBM standard timestamp". I believe that the network behavior should conform to the existing embedded behavior and that Derby's network layer should support the full range of timestamps allowed by JDBC. There are of course compatibility issues here. I propose the following solution: o If both the client and the server are Derby code at 10.6 or higher, then timestamps should not be truncated. o However, if either the client or the server is not Derby code at 10.6 or higher, then truncation should continue to occur. Implementation notes: The truncation client->server happens in DateTime.timestampToTimestampBytes(). which is read by DRDAConnThread.readAndSetParams() The truncation server->client happens in DRDAConnThread.writeFdocaVal() which is read by DateTime.timestampBytesToTimestamp() > TIMESTAMP value is truncated when return to client > --------------------------------------------------- > > Key: DERBY-2602 > URL: https://issues.apache.org/jira/browse/DERBY-2602 > Project: Derby > Issue Type: Bug > Components: Network Client > Affects Versions: 10.3.1.4 > Reporter: Kathey Marsden > Priority: Minor > Attachments: d2602.java > > > In ParameterMappingTest I see the following differences between embedded and client. Client is truncating the TIMESTAMP value. Look for this bug number in the test for reproduction. > case java.sql.Types.TIMESTAMP: > if (param == 2) > if (usingEmbedded()) > assertEquals("2004-03-12 21:14:24.938222433", val.toString()); > else > assertEquals("2004-03-12 21:14:24.938222", val.toString()); > else if (param == 3) > if (usingEmbedded()) > assertEquals("2004-04-12 04:25:26.462983731", val.toString()); > else > assertEquals("2004-04-12 04:25:26.462983", val.toString()); > break; -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.