Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 44319 invoked from network); 16 Jan 2007 12:05:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jan 2007 12:05:49 -0000 Received: (qmail 87068 invoked by uid 500); 16 Jan 2007 12:05:55 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 87040 invoked by uid 500); 16 Jan 2007 12:05:54 -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 87031 invoked by uid 99); 16 Jan 2007 12:05:54 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jan 2007 04:05:54 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jan 2007 04:05:47 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A23917142B5 for ; Tue, 16 Jan 2007 04:05:27 -0800 (PST) Message-ID: <13480739.1168949127662.JavaMail.jira@brutus> Date: Tue, 16 Jan 2007 04:05:27 -0800 (PST) From: "Mayuresh Nirhali (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-2103) After a Lexical Error due to syntax error , even a simple create table does not work on the same connection. In-Reply-To: <20538891.1164067441929.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12465138 ] Mayuresh Nirhali commented on DERBY-2103: ----------------------------------------- After some investigation, I found that, when the expected error happens, lookingAhead flag in SQLParser implementation is true and due to the exception this flag is not cleared. The parser object is cached and later used by the next parsing activity. Following code demonstrates the scenario. final private boolean jj_3_12() { Token xsp; xsp = jj_scanpos; lookingAhead = true; jj_semLA = getToken(3).kind != LARGE; // ------- The exception happens in this call lookingAhead = false; // ------- This is not called due to the exception. if (!jj_semLA || jj_3R_60()) return true; if (jj_3R_61()) return true; return false; } The simple fix could be to wrap the lookingAhead assignment after the call within finally block. then, the same method would look like below, lookingAhead = true; try { jj_semLA = getToken(3).kind != LARGE; } finally { lookingAhead = false; } I tried this and this has fixed the testcase. Now, my concern is that, there are many such methods in SQLParser implementation.For the fix to be complete and to be able to avoid future issues due to same problem, all methods which should change needs to identified. While, I am trying to do the same, I would really appreciate any inputs in this regard. Thanks, Mayuresh > After a Lexical Error due to syntax error , even a simple create table does not work on the same connection. > ---------------------------------------------------------------------------------------------------------------- > > Key: DERBY-2103 > URL: https://issues.apache.org/jira/browse/DERBY-2103 > Project: Derby > Issue Type: Bug > Affects Versions: 10.3.0.0 > Reporter: Suresh Thalamati > Assigned To: Mayuresh Nirhali > Priority: Minor > > connect 'jdbc:derby:wombat;create=true'; > create table t1(a int ) ; > create table "t2"(a int ) ; > -- this should fail. > create table foo (a int , \"YEAR\" int ) ; > -- but this should not fail. But failing > create table t4 ( b int ) ; > FYI: > $ java org.apache.derby.tools.ij > ij version 10.3 > ij> run 'weird1.sql'; > ij> connect 'jdbc:derby:wombat;create=true'; > ij> create table t1(a int ) ; > 0 rows inserted/updated/deleted > ij> create table "t2"(a int ) ; > 0 rows inserted/updated/deleted > ij> -- this should fail. > create table foo (a int , \"YEAR\" int ) ; > ERROR 42X02: Lexical error at line 2, column 28. Encountered: "\\" (92), after > : "". > ij> -- but this should not fail. But failing > create table t4 ( b int ) ; > ERROR 42X01: Syntax error: Encountered "" at line 2, column 21. > ij> -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira