Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 758A176A5 for ; Tue, 6 Sep 2011 17:03:42 +0000 (UTC) Received: (qmail 51898 invoked by uid 500); 6 Sep 2011 17:03:42 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 51868 invoked by uid 500); 6 Sep 2011 17:03: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 51861 invoked by uid 99); 6 Sep 2011 17:03:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Sep 2011 17:03:41 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Sep 2011 17:03:38 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 6F1D8837F6 for ; Tue, 6 Sep 2011 17:03:17 +0000 (UTC) Date: Tue, 6 Sep 2011 17:03:17 +0000 (UTC) From: "Myrna van Lunteren (JIRA)" To: derby-dev@db.apache.org Message-ID: <783421039.21170.1315328597451.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1726351969.21145.1315328229846.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (DERBY-5403) implement further syntax for truncate table support - identityBehavior clause MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-5403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Myrna van Lunteren updated DERBY-5403: -------------------------------------- Priority: Minor (was: Major) > implement further syntax for truncate table support - identityBehavior clause > ----------------------------------------------------------------------------- > > Key: DERBY-5403 > URL: https://issues.apache.org/jira/browse/DERBY-5403 > Project: Derby > Issue Type: Improvement > Components: SQL > Reporter: Myrna van Lunteren > Priority: Minor > > Since 10.7 basic support for TRUNCATE TABLE has been implemented (see DERBY-268) and documented (see DERBY-4802). > However, according to the SQL Standard (F200 in SQL:2008) the full syntax includes an identityBehavior clause: > TRUNCATE TABLE tableName [ identityBehavior ] > identityBehavior ::= > CONTINUE IDENTITY > | RESTART IDENTITY > This clause has not been fully implemented. > Reading through DERBY-268 yields more details, e.g.: > (https://issues.apache.org/jira/browse/DERBY-268?focusedCommentId=12905937&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12905937): > "A follow-on effort might be to implement the optional CONTINUE IDENTITY and RESTART IDENTITY clauses. Fortunately, the tricky bit of RESTART IDENTITY has already been implemented. The tricky bit is the following implied statement which is executed after truncating the table: > ALTER TABLE tableName ALTER COLUMN RESTART WITH initialValue " > and: > (https://issues.apache.org/jira/browse/DERBY-268?focusedCommentId=12912378&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12912378) "[...]sqlgrammar.jj would be a good starting point" > and: > ( https://issues.apache.org/jira/browse/DERBY-268?focusedCommentId=12916134&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12916134): > [...]all of this code should be in the engine. The good news is that both TRUNCATE TABLE and ALTER TABLE ALTER COLUMN RESTART are handled by the AlterTableConstantAction machinery at run time. If I were tackling this, I would first try something along these lines: > o AlterTableNode.bindStatement() will need to build a tableElementList structure for TRUNCATE TABLE, describing the identity column which needs to be re-initialized. For ALTER TABLE ALTER COLUMN RESTART, that tableElementList is created by the parser. > o That tableElementList structure will then be picked up by AlterTableNode.prepConstantAction and turned into a ColumnInfo array when the run time structures are generated for TRUNCATE TABLE. The ColumnInfo[] structure should contain enough information to describe the change to the identity column. > o The column info structure will then be processed by AlterTableConstantAction.executeConstantAction() at run time. > You may need to tweak the code a bit to get this to function, but I think this basic processing flow should work.[...]" > and the comments in DERBY-268 after Oct 10, 2010 all refer to an aborted attempt by Eranda to work on this functionality, including a tentative patch. > I'll mark this issue beginner because of that preliminary work. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira