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 "Daniel John Debrunner (JIRA)" <de...@db.apache.org> on 2006/08/29 16:20:29 UTC

[jira] Created: (DERBY-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
--------------------------------------------------------------------------

                 Key: DERBY-1776
                 URL: http://issues.apache.org/jira/browse/DERBY-1776
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.2.1.0, 10.3.0.0
            Reporter: Daniel John Debrunner
            Priority: Minor


create table t (i int, x xml);
select xmlserialize(x) from t;

ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.

This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught be regular parsing?

-- 
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-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

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

Mike Matrigali updated DERBY-1776:
----------------------------------

    Fix Version/s: 10.2.1.0
                   10.3.0.0

reviewed and committed patch as is to trunk.  It can be merged to 10.2.

Well, after that paragraph of justification, it turns out that there are only three places where we use the 42Z79 SQLSTATE. But still, I think it's a useful error message and should be kept around; it could come in handy further down the road if SQL/XML functionality is expanded.

As for line/column numbers, it turns out that those values are readily available from within sqlgrammar.jj and thus can easily be passed as part of the error message. The only potential downside that I can see is that we have to create an Integer object out of the line/col numbers in order to pass them to the StandardException constructor...but maybe that's not a big deal...? The fact that no one has done this earlier makes me wonder if there's some "gotcha" here that I'm missing, but I haven't seen any problems with it just yet...

Attaching a patch d1776_v1.patch that changes the error message for 42Z79 as mentioned in my previous comment and also does the following:

  1. Adds line and column numbers to the error message to indicate where
     the missing keyword is expected.

  2. Removes one "lookahead" call that was causing 42Z79 to be raised
     for a missing "AS" keyword when in fact the keyword was present
     (what was missing was the datatype). To avoid confusion, I
     removed the lookahead and now the user will see a more generic
     42X01 error in that particular case.

  3. Updated xml_general master files accordingly.

So with this patch applied, instead of:

 select xmlserialize(x) from t;
 ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.

we'll now see:

 create table t (i int, x xml);
 ERROR 42Z72: Missing SQL/XML keyword(s) 'AS' at line 1, column 22. 

> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1776
>                 URL: http://issues.apache.org/jira/browse/DERBY-1776
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0, 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Assigned To: A B
>            Priority: Minor
>             Fix For: 10.2.1.0, 10.3.0.0
>
>         Attachments: d1776_v1.patch
>
>
> create table t (i int, x xml);
> select xmlserialize(x) from t;
> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.
> This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

-- 
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-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

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

A B updated DERBY-1776:
-----------------------

      Assignee: A B
    Derby Info: [Patch Available]

> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1776
>                 URL: http://issues.apache.org/jira/browse/DERBY-1776
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0, 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Assigned To: A B
>            Priority: Minor
>         Attachments: d1776_v1.patch
>
>
> create table t (i int, x xml);
> select xmlserialize(x) from t;
> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.
> This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

-- 
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-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

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

A B updated DERBY-1776:
-----------------------

    Attachment: d1776_reuseInt.patch

In a review comment for a different issue someone mentioned that instead of creating new Integer() objects it'd be better to use the Derby ReuseFactory where possible to avoid excessive object creation.  I get the feeling that's not a big deal with the _v1 patch for this issue, but I nonetheless thought it'd be a good idea to follow that advice with the changes.

So I'm attaching a tiny patch, d1776_reuseInt.patch, that replaces the calls to "new Integer()" in the _v1 patch (which has already  been committed) with calls to ReuseFactory.getInteger().  Functionally, the patch doesn't change anything.

I ran xmlSuite on Windows 2000 with ibm142 and all tests passed.

> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1776
>                 URL: http://issues.apache.org/jira/browse/DERBY-1776
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0, 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Assigned To: A B
>            Priority: Minor
>             Fix For: 10.2.1.0, 10.3.0.0
>
>         Attachments: d1776_reuseInt.patch, d1776_v1.patch
>
>
> create table t (i int, x xml);
> select xmlserialize(x) from t;
> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.
> This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

-- 
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] Commented: (DERBY-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

Posted by "A B (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1776?page=comments#action_12435586 ] 
            
A B commented on DERBY-1776:
----------------------------

> wouldn't the error be caught by regular parsing?

Yes, regular parsing would catch this and other SQL/XML-related syntax errors, but the error message is somewhat unhelpful--I can't remember exactly, but it's something like

  "Encountered ')' at line x column y."

And while it's true that a user could eventually figure it out, I thought that, given the high number of required keywords for the SQL/XML operators, it'd be more user friendly to actually provide a hint as to what was really missing.  When you consider that the SQL/XML syntax tends to be rather wordy and that SQL/XML operators are often used one on top of the other (ex. XMLSERIALIZE (XMLQUERY(...)...), it's pretty easy to end up with long lines of query--and frankly, I as a user found myself getting impatient trying to figure out which operator was missing what keyword.  So I created 42Z72.

I guess one option is to remove that message altogether and let the user count lines and columns to find out where the unexpected ')' is and what it's supposed to be.  But instead of that, I'd rather just reword the error message to address the fact that this is "not an XML syntax error, it's a syntax in the SQL language".  Maybe something like:

ERROR 42Z72: Missing SQL/XML keyword(s): 'AS'. 

Does that seem like an acceptable approach?

> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1776
>                 URL: http://issues.apache.org/jira/browse/DERBY-1776
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0, 10.3.0.0
>            Reporter: Daniel John Debrunner
>            Priority: Minor
>
> create table t (i int, x xml);
> select xmlserialize(x) from t;
> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.
> This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

-- 
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] Resolved: (DERBY-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

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

Andrew McIntyre resolved DERBY-1776.
------------------------------------

    Resolution: Fixed
    Derby Info:   (was: [Patch Available])

Marking resolved, merged to 10.2 branch with revision 449013. 

> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1776
>                 URL: http://issues.apache.org/jira/browse/DERBY-1776
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0, 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Assigned To: A B
>            Priority: Minor
>             Fix For: 10.2.1.0, 10.3.0.0
>
>         Attachments: d1776_reuseInt.patch, d1776_v1.patch
>
>
> create table t (i int, x xml);
> select xmlserialize(x) from t;
> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.
> This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

-- 
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-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

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

A B updated DERBY-1776:
-----------------------

    Attachment: d1776_v1.patch

Well, after that paragraph of justification, it turns out that there are only three places where we use the 42Z79 SQLSTATE.  But still, I think it's a useful error message and should be kept around; it could come in handy further down the road if SQL/XML functionality is expanded.

As for line/column numbers, it turns out that those values are readily available from within sqlgrammar.jj and thus can easily be passed as part of the error message.  The only potential downside that I can see is that we have to create an Integer object out of the line/col numbers in order to pass them to the StandardException constructor...but maybe that's not a big deal...?  The fact that no one has done this earlier makes me wonder if there's some "gotcha" here that I'm missing, but I haven't seen any problems with it just yet...

Attaching a patch d1776_v1.patch that changes the error message for 42Z79 as mentioned in my previous comment and also does the following:

  1. Adds line and column numbers to the error message to indicate where
     the missing keyword is expected.

  2. Removes one "lookahead" call that was causing 42Z79 to be raised
     for a missing "AS" keyword when in fact the keyword was present
     (what was missing was the datatype).  To avoid confusion, I
     removed the lookahead and now the user will see a more generic
     42X01 error in that particular case.

  3. Updated xml_general master files accordingly.

So with this patch applied, instead of:

 select xmlserialize(x) from t;
 ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. 

we'll now see:

 create table t (i int, x xml);
 ERROR 42Z72: Missing SQL/XML keyword(s) 'AS' at line 1, column 22.

I ran xmlSuite with this patch and all of the tests passed.  I haven't run derbyall yet and I don't expect any failures (since the changes are theoretically limited to XML) but I will try to run it tonight just for sanity.  In the meantime, review comments would be great.

> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1776
>                 URL: http://issues.apache.org/jira/browse/DERBY-1776
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0, 10.3.0.0
>            Reporter: Daniel John Debrunner
>            Priority: Minor
>         Attachments: d1776_v1.patch
>
>
> create table t (i int, x xml);
> select xmlserialize(x) from t;
> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.
> This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

-- 
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-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

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

Daniel John Debrunner updated DERBY-1776:
-----------------------------------------

    Description: 
create table t (i int, x xml);
select xmlserialize(x) from t;

ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.

This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

  was:
create table t (i int, x xml);
select xmlserialize(x) from t;

ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.

This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught be regular parsing?


> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1776
>                 URL: http://issues.apache.org/jira/browse/DERBY-1776
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0, 10.3.0.0
>            Reporter: Daniel John Debrunner
>            Priority: Minor
>
> create table t (i int, x xml);
> select xmlserialize(x) from t;
> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.
> This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

-- 
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] Commented: (DERBY-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

Posted by "A B (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1776?page=comments#action_12435907 ] 
            
A B commented on DERBY-1776:
----------------------------

derbyall on Windows 2000 with ibm142 against sane jars ran with no new failures.  So this patch is ready for review/commit.

> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1776
>                 URL: http://issues.apache.org/jira/browse/DERBY-1776
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0, 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Assigned To: A B
>            Priority: Minor
>         Attachments: d1776_v1.patch
>
>
> create table t (i int, x xml);
> select xmlserialize(x) from t;
> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.
> This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

-- 
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] Commented: (DERBY-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1776?page=comments#action_12435590 ] 
            
Daniel John Debrunner commented on DERBY-1776:
----------------------------------------------

Yes, though the loss of the line and column number is a shame.
Be useful to know how you implemented this, so that other more helpful messages could be added in the future.
Maybe add to the wiki?
http://wiki.apache.org/db-derby/LanguageSystem

> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1776
>                 URL: http://issues.apache.org/jira/browse/DERBY-1776
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0, 10.3.0.0
>            Reporter: Daniel John Debrunner
>            Priority: Minor
>
> create table t (i int, x xml);
> select xmlserialize(x) from t;
> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.
> This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

-- 
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] Closed: (DERBY-1776) ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text

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

A B closed DERBY-1776.
----------------------


Changes in trunk and 10.2 and no further comments, so closing the issue.

> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. - Misleading text
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1776
>                 URL: http://issues.apache.org/jira/browse/DERBY-1776
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6, 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Assigned To: A B
>            Priority: Minor
>             Fix For: 10.2.1.6, 10.3.0.0
>
>         Attachments: d1776_reuseInt.patch, d1776_v1.patch
>
>
> create table t (i int, x xml);
> select xmlserialize(x) from t;
> ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'.
> This is not an 'XML Syntax error', it's a syntax in the SQL language. No need to have a special error messgae here, wouldn't the error be caught by regular parsing?

-- 
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