You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Mamta A. Satoor (JIRA)" <de...@db.apache.org> on 2005/11/09 06:41:19 UTC

[jira] Created: (DERBY-693) Incorrect line number in the error message when parser throws syntax error in some specific examples

Incorrect line number in the error message when parser throws syntax error in some specific examples
----------------------------------------------------------------------------------------------------

         Key: DERBY-693
         URL: http://issues.apache.org/jira/browse/DERBY-693
     Project: Derby
        Type: Bug
  Components: SQL  
    Versions: 10.2.0.0    
    Reporter: Mamta A. Satoor


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 "<EOF>" at line 1, column 8.
ij> select
;
ERROR 42X01: Syntax error: Encountered "<EOF>" 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.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-693) Incorrect line number in the error message when parser throws syntax error in some specific examples

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Hillegas updated DERBY-693:
--------------------------------

    Issue & fix info: [Known fix, Newcomer, Repro attached]
             Urgency: Normal

Triaged for 10.5.3: assigned normal urgency, marked as "known fix", "newcomer", and "repro attached".

> 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 "<EOF>" at line 1, column 8.
> ij> select
> ;
> ERROR 42X01: Syntax error: Encountered "<EOF>" 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.


[jira] Updated: (DERBY-693) Incorrect line number in the error message when parser throws syntax error in some specific examples

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-693?page=all ]

Daniel John Debrunner updated DERBY-693:
----------------------------------------

    Priority: Minor  (was: Major)

Seems like a minor issue to me, maybe even a trivial one.

> Incorrect line number in the error message when parser throws syntax error in some specific examples
> ----------------------------------------------------------------------------------------------------
>
>          Key: DERBY-693
>          URL: http://issues.apache.org/jira/browse/DERBY-693
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.2.0.0
>     Reporter: Mamta A. Satoor
>     Priority: Minor

>
> 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 "<EOF>" at line 1, column 8.
> ij> select
> ;
> ERROR 42X01: Syntax error: Encountered "<EOF>" 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.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-693) Incorrect line number in the error message when parser throws syntax error in some specific examples

Posted by "Rick Hillegas (JIRA)" <ji...@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 "<EOF>" at line 1, column 8.
> ij> select
> ;
> ERROR 42X01: Syntax error: Encountered "<EOF>" 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.