Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 5803 invoked from network); 21 Jul 2009 16:21:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Jul 2009 16:21:45 -0000 Received: (qmail 91106 invoked by uid 500); 21 Jul 2009 16:22:48 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 90837 invoked by uid 500); 21 Jul 2009 16:22:47 -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 90790 invoked by uid 99); 21 Jul 2009 16:22:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jul 2009 16:22:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED 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; Tue, 21 Jul 2009 16:22:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id CE332234C045 for ; Tue, 21 Jul 2009 09:22:14 -0700 (PDT) Message-ID: <1385534683.1248193334831.JavaMail.jira@brutus> Date: Tue, 21 Jul 2009 09:22:14 -0700 (PDT) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-693) Incorrect line number in the error message when parser throws syntax error in some specific examples In-Reply-To: <1583298611.1131514879812.JavaMail.jira@ajax.apache.org> 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-693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rick Hillegas updated DERBY-693: -------------------------------- Attachment: w.sql Attaching repro, w.sql. > Incorrect line number in the error message when parser throws syntax error in some specific examples > ---------------------------------------------------------------------------------------------------- > > Key: DERBY-693 > URL: https://issues.apache.org/jira/browse/DERBY-693 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.2.1.6 > Reporter: Mamta A. Satoor > Priority: Minor > Attachments: w.sql > > > After connecting to a database through ij, parser returns correct line number for the sql "select" the first time around but it returns incorrect line number when the same sql is rexecuted, as shown below > $ java org.apache.derby.tools.ij > ij version 10.2 > ij> connect 'jdbc:derby:c:/dellater/db1'; > ij> select > ; > ERROR 42X01: Syntax error: Encountered "" at line 1, column 8. > ij> select > ; > ERROR 42X01: Syntax error: Encountered "" at line 2, column 8. > ij> > This is caused by UCode_CharStream's UpdateLineColumn method. When the sql "select" is executed the first time, the parser comes to UpdateLineColumn method for trailing \r and then for trailing \n for the first line "select". The trailing \n causes the prevCharIsLF to be set to true. Since this sql is incorrect by itself, parser will throw a syntax error. After the exception and before the processing of next sql "select", this prevCharIsLF flag does not get set to false(this is the problem). When the first character "s" is read, UpdateLineColumn checks if prevCharIsLF set to true and if yes, it increments(incorrectly) the line number to 2 and that is why the second time around, execution of "select" gives syntax error at line 2 rather than line 1. > This also causes problem with the optimizer hints when they are used in incorrect context as shown below. > $ java org.apache.derby.tools.ij > ij version 10.2 > ij> connect 'jdbc:derby:c:/dellater/db1'; > ij> -- derby-properties > select * from t1; > ERROR 42X01: Syntax error: Encountered "derby-properties" at line 1, column 4. > ij> -- derby-properties > select * from t1; > ERROR 42X01: Syntax error: Encountered "derby-properties" at line 2, column 4. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.