[ 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

        

Reply via email to