Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 95326 invoked from network); 7 Dec 2009 13:20:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Dec 2009 13:20:42 -0000 Received: (qmail 13270 invoked by uid 500); 7 Dec 2009 13:20:41 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 13222 invoked by uid 500); 7 Dec 2009 13:20:41 -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 13214 invoked by uid 99); 7 Dec 2009 13:20:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Dec 2009 13:20:41 +0000 X-ASF-Spam-Status: No, hits=-10.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI 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, 07 Dec 2009 13:20:38 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 328AE234C1F1 for ; Mon, 7 Dec 2009 05:20:18 -0800 (PST) Message-ID: <671710599.1260192018205.JavaMail.jira@brutus> Date: Mon, 7 Dec 2009 13:20:18 +0000 (UTC) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Issue Comment Edited: (DERBY-651) Re-enable the storing of java objects in the database In-Reply-To: <1964282168.1130361355487.JavaMail.jira@ajax.apache.org> 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-651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12786715#action_12786715 ] Rick Hillegas edited comment on DERBY-651 at 12/7/09 1:19 PM: -------------------------------------------------------------- Attaching derby-651-05-ac-dependencyTable.diff. This adds persistent dependency tracking between tables and the UDT types of their columns. This patch prevents you from dropping a UDT if there are tables whose columns rely on that type. Regression tests passed cleanly for me. Ideally, we would like to track these dependencies at column granularity. However, columns don't have UUIDs. UUIDs identify the tuple descriptors which are endpoints of arcs in the dependency graph. The following design choice had to be made: 1) Create UUIDs for every column. 2) Track the dependency at a higher level, drawing the arcs between tables and UDTs rather than between columns and UDTs. Option (1) looked like a lot of work with a high probability of destabilizing the codeline. I opted for (2) instead. This ended up pushing some complexity into one localized method: DDLConstantAction.adjustUDTDependencies(). That method is responsible for making sure that there is only one dependency arc between a table and a UDT, regardless of how many columns in the table may share that UDT type. Touches the following files: M java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java M java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java M java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java M java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java Adds a dictionary method for looking up the AliasDescriptor associated with a UDT. This AliasDescriptor is the persistent object that is one of the endpoints of a dependency arc. M java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java M java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java M java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java Boilerplate to support DROP TYPE. M java/engine/org/apache/derby/loc/messages.xml M java/shared/org/apache/derby/shared/common/reference/SQLState.java New error message raised when a dependent table prevents a UDT from being dropped. M java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java Made DROP COLUMN nodes report that they are DROP COLUMN nodes rather than MODIFY COLUMN nodes. Some of the DROP COLUMN logic was being skipped. M java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java Made it possible for a table to be the starting point of a dependency arc. Previously, a table could only be the ending point of a dependency arc. M java/engine/org/apache/derby/impl/sql/compile/TableElementList.java M java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java M java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java M java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java This is the heart of the logic which adds and drops the dependency arc from a table to a UDT. M java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java M java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java M java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java More debug machinery for printing out the contents of DDL nodes in the AST. Debug support for DDL nodes seems weak. M java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java Basic tests to verify that if a table has a UDT column then that UDT cannot be dropped. was (Author: rhillegas): Attaching derby-651-05-ac-dependencyTable.diff. This adds persistent dependency tracking between tables and the UDT types of their columns. This patch prevents you from dropping a UDT if there are tables whose columns rely on that type. Ideally, we would like to track these dependencies at column granularity. However, columns don't have UUIDs. UUIDs identify the tuple descriptors which are endpoints of arcs in the dependency graph. The following design choice had to be made: 1) Create UUIDs for every column. 2) Track the dependency at a higher level, drawing the arcs between tables and UDTs rather than between columns and UDTs. Option (1) looked like a lot of work with a high probability of destabilizing the codeline. I opted for (2) instead. This ended up pushing some complexity into one localized method: DDLConstantAction.adjustUDTDependencies(). That method is responsible for making sure that there is only one dependency arc between a table and a UDT, regardless of how many columns in the table may share that UDT type. Touches the following files: M java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java M java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java M java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java M java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java Adds a dictionary method for looking up the AliasDescriptor associated with a UDT. This AliasDescriptor is the persistent object that is one of the endpoints of a dependency arc. M java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java M java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java M java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java Boilerplate to support DROP TYPE. M java/engine/org/apache/derby/loc/messages.xml M java/shared/org/apache/derby/shared/common/reference/SQLState.java New error message raised when a dependent table prevents a UDT from being dropped. M java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java Made DROP COLUMN nodes report that they are DROP COLUMN nodes rather than MODIFY COLUMN nodes. Some of the DROP COLUMN logic was being skipped. M java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java Made it possible for a table to be the starting point of a dependency arc. Previously, a table could only be the ending point of a dependency arc. M java/engine/org/apache/derby/impl/sql/compile/TableElementList.java M java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java M java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java M java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java This is the heart of the logic which adds and drops the dependency arc from a table to a UDT. M java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java M java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java M java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java More debug machinery for printing out the contents of DDL nodes in the AST. Debug support for DDL nodes seems weak. M java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java Basic tests to verify that if a table has a UDT column then that UDT cannot be dropped. > Re-enable the storing of java objects in the database > ----------------------------------------------------- > > Key: DERBY-651 > URL: https://issues.apache.org/jira/browse/DERBY-651 > Project: Derby > Issue Type: Improvement > Components: SQL > Reporter: Rick Hillegas > Assignee: Rick Hillegas > Attachments: derby-651-01-aa-basicCreateDropType.diff, derby-651-02-af-udtColumnsRetvalsParams.diff, derby-651-03-aa-udttestInstability.diff, derby-651-04-aa-javadoc.diff, derby-651-05-ac-dependencyTable.diff, UserDefinedTypes.html, UserDefinedTypes.html, UserDefinedTypes.html, UserDefinedTypes.html > > > Islay Symonette, in an email thread called "Storing Java Objects in a table" on October 26, 2005 requests the ability to store java objects in the database. > Old releases of Cloudscape allow users to declare a column's type to be a Serializable class. This feature was removed from Derby because the syntax was non-standard. However, most of the machinery to support objects serialized to columns is still in Derby and is even used in system tables. We need to agree on some standard syntax here and re-expose this useful feature. Some subset of the ANSI adt syntax, cumbersome as it is, would do. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.