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)" <ji...@apache.org> on 2007/02/16 23:55:05 UTC

[jira] Created: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

Use of XML values in the action statement of a trigger throw exceptions.
------------------------------------------------------------------------

                 Key: DERBY-2350
                 URL: https://issues.apache.org/jira/browse/DERBY-2350
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.3.0.0
            Reporter: Daniel John Debrunner


A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.

CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
                REFERENCING NEW_TABLE AS N
                FOR EACH STATEMENT  
                INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
                SELECT 'I', V, ID, V FROM N

ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.

Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.

TriggerTest shows this issue, see the comment with the bug number to reproduce.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508981 ] 

Daniel John Debrunner commented on DERBY-2350:
----------------------------------------------

Some trigger background here:

http://wiki.apache.org/db-derby/TriggerImplementation

I believe 2) is the best approach. The before & after rows are currently forced as JDBC objects which means a performance hit for most datatypes.
There's no reason to use JDBC, it's a hang over from Cloudscape 4.x when a non-standard mechanism was provided to access the before & after rows. But now Derby uses standard SQL to access the before & after rows, thus there is no requirement to convert the row into a JDBC form, keeping the rows as Derby rows (Row & DataValueDescriptor's) would make more sense. This approach would also avoid any jdk specific issues since the SQLXML datatype was only introduced in JDBC 4.

Not sure of the effort involved, I'll try to think about it.

> Use of XML values in the action statement of a trigger throw exceptions.
> ------------------------------------------------------------------------
>
>                 Key: DERBY-2350
>                 URL: https://issues.apache.org/jira/browse/DERBY-2350
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Daniel John Debrunner
>
> A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.
> CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
>                 REFERENCING NEW_TABLE AS N
>                 FOR EACH STATEMENT  
>                 INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
>                 SELECT 'I', V, ID, V FROM N
> ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.
> Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.
> TriggerTest shows this issue, see the comment with the bug number to reproduce.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

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

Mike Matrigali updated DERBY-2350:
----------------------------------


Thanks for posting the patch got my original changes to work, I have some time to work on this now.  I think it is better to get this fix in, even if xml trigger is not optimal.  It does not work at all without it.  I am going to run some tests and see if I can get this into trunk and 10.3.  I will also create a follow on JIRA issue to log possible performance improvements in the future.  

> Use of XML values in the action statement of a trigger throw exceptions.
> ------------------------------------------------------------------------
>
>                 Key: DERBY-2350
>                 URL: https://issues.apache.org/jira/browse/DERBY-2350
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Daniel John Debrunner
>            Assignee: Mike Matrigali
>         Attachments: d2350_v2.patch, derby-2350.diff
>
>
> A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.
> CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
>                 REFERENCING NEW_TABLE AS N
>                 FOR EACH STATEMENT  
>                 INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
>                 SELECT 'I', V, ID, V FROM N
> ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.
> Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.
> TriggerTest shows this issue, see the comment with the bug number to reproduce.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

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

Mike Matrigali updated DERBY-2350:
----------------------------------

    Attachment: derby-2350.diff

This patch is not ready for commit, it shows some intial work I did to try for 
a tempory solution.  It gets a different error than before, not sure why.  I don't currently plan on doing more on this one, if anyone is interested feel free to pick it up or fix it some other way.

> Use of XML values in the action statement of a trigger throw exceptions.
> ------------------------------------------------------------------------
>
>                 Key: DERBY-2350
>                 URL: https://issues.apache.org/jira/browse/DERBY-2350
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Attachments: derby-2350.diff
>
>
> A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.
> CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
>                 REFERENCING NEW_TABLE AS N
>                 FOR EACH STATEMENT  
>                 INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
>                 SELECT 'I', V, ID, V FROM N
> ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.
> Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.
> TriggerTest shows this issue, see the comment with the bug number to reproduce.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

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

Mike Matrigali resolved DERBY-2350.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 10.3.1.4

fixed in trunk and 10.3 branch.

Fix XML in triggers by changing code generation to generate different code
in the case of XML of the form when referencing old and new column values.:
XMLPARSE(DOCUMENT
CAST (org.apache.derby.iapi.db.Factory::
getTriggerExecutionContext().getNewRow().
getString(<colPosition>) AS CLOB)
PRESERVE WHITESPACE)

Also change XML.setValueFromResult() to validate the character stream and
set the xType as appropriate after parsing the stream.

> Use of XML values in the action statement of a trigger throw exceptions.
> ------------------------------------------------------------------------
>
>                 Key: DERBY-2350
>                 URL: https://issues.apache.org/jira/browse/DERBY-2350
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Daniel John Debrunner
>            Assignee: Mike Matrigali
>             Fix For: 10.3.1.4
>
>         Attachments: d2350_v2.patch, derby-2350.diff
>
>
> A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.
> CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
>                 REFERENCING NEW_TABLE AS N
>                 FOR EACH STATEMENT  
>                 INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
>                 SELECT 'I', V, ID, V FROM N
> ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.
> Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.
> TriggerTest shows this issue, see the comment with the bug number to reproduce.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

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

Mike Matrigali reassigned DERBY-2350:
-------------------------------------

    Assignee: Mike Matrigali

> Use of XML values in the action statement of a trigger throw exceptions.
> ------------------------------------------------------------------------
>
>                 Key: DERBY-2350
>                 URL: https://issues.apache.org/jira/browse/DERBY-2350
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Daniel John Debrunner
>            Assignee: Mike Matrigali
>         Attachments: d2350_v2.patch, derby-2350.diff
>
>
> A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.
> CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
>                 REFERENCING NEW_TABLE AS N
>                 FOR EACH STATEMENT  
>                 INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
>                 SELECT 'I', V, ID, V FROM N
> ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.
> Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.
> TriggerTest shows this issue, see the comment with the bug number to reproduce.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

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

Mike Matrigali updated DERBY-2350:
----------------------------------


What would be the right approach to fixing this one?  Seems like the options are:
1) implement full XML support in JDBC 
     o is this even possible for jdk1.4 and jdk1.5 - is there XML support there?
2) change trigger implementation to not use jdbc
     o if we take this route, does anyone have an idea the extent of the changes necessary?   Would such a change be appropriate
         as a bug fix to an existing release or would it be a feature to new release?

Long term is one choice better architecturally?  Does option 2 allow us to better optimize the performance?

> Use of XML values in the action statement of a trigger throw exceptions.
> ------------------------------------------------------------------------
>
>                 Key: DERBY-2350
>                 URL: https://issues.apache.org/jira/browse/DERBY-2350
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Daniel John Debrunner
>
> A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.
> CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
>                 REFERENCING NEW_TABLE AS N
>                 FOR EACH STATEMENT  
>                 INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
>                 SELECT 'I', V, ID, V FROM N
> ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.
> Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.
> TriggerTest shows this issue, see the comment with the bug number to reproduce.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

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

A B updated DERBY-2350:
-----------------------

    Attachment: d2350_v2.patch

Attaching d2350_v2.patch, which is Mike's original patch plus some changes in iapi/types/XML.java to solve the error that he mentioned in his previous comment.

The problem is actually in the "setValueFromResultSet()" method of XML.java.  That method is called from VTIResultSet and is used to "load" results from into the target XML column.  But that method does not set the 'xType" field, which means it defaults to -1.  Then later, when we try to normalize the XML value in preparation for insertion into the XML column, we throw an error because an xType of "-1" indicates that the XML value is not a well-formed DOCUMENT.

The easiest fix would be to add a single line to XML.setValueFromResult() that sets "xType" to XML_DOC_ANY.  However, I do not know if we can safely assume that the string value in the received ResultSet is well-formed XML.  My inclination is to believe that we canNOT make such an assumption, though I can't currently think of any examples to prove it.   To be cautious we need some admittedly ugly code to check the well-formedness of the string value in question.  (Since the result set object is java.sql.ResultSet , and since "getObject()" won't work, we have to jump through some hoops to figure out if the desired column is in fact an XML value).

The attached patch makes changes to set "xType" based on whether or not the string value in question is well-formed XML.  This is rather undesirable, though, because this change in combination with Mike's change in CreateTriggerNode means that we are now parsing each XML value *TWO* additional times--once as part of the rewrite contributed by Mike, and again when we get to setValueFromResultSet().  That seems like it could lead to pretty bad performance very easily...

That said, though, I'm not sure what the alternatives are outside of the trigger re-write mentioned by Dan and Mike in preceding comments.  So I'm posting this far-less-than-ideal solution in case people think it's worth committing.  I ran lang/TriggerTest.java and suites.XMLSuite on Windows using ibm142 and saw no failures.  I haven't run any other tests...

> Use of XML values in the action statement of a trigger throw exceptions.
> ------------------------------------------------------------------------
>
>                 Key: DERBY-2350
>                 URL: https://issues.apache.org/jira/browse/DERBY-2350
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Attachments: d2350_v2.patch, derby-2350.diff
>
>
> A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.
> CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
>                 REFERENCING NEW_TABLE AS N
>                 FOR EACH STATEMENT  
>                 INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
>                 SELECT 'I', V, ID, V FROM N
> ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.
> Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.
> TriggerTest shows this issue, see the comment with the bug number to reproduce.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512810 ] 

Daniel John Debrunner commented on DERBY-2350:
----------------------------------------------

The issue might be that the patch only addresses (I think) row level triggers, but the test uses statement level and row level triggers.
That would lead to the error seen, as only a statement trigger will end up calling the setValueFromResultSet method.

Bryan wrote:
> What about "sniffing" the first few bytes of the string? To be a valid document,
> it should either start with <?xml , possibly preceded by a bytemark, or < and a tag.

> Not a perfect test by any means, but vastly less expensive than cranking up the XML parser.

I might be missing something here, but how does this help? Are you saying that would be the only test?
As you point out it's not sufficient, so we would need to use the parser anyway. It seems it would only help kick out
invalid values earlier, which is not really a case we want to optimize for.

> Use of XML values in the action statement of a trigger throw exceptions.
> ------------------------------------------------------------------------
>
>                 Key: DERBY-2350
>                 URL: https://issues.apache.org/jira/browse/DERBY-2350
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Attachments: d2350_v2.patch, derby-2350.diff
>
>
> A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.
> CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
>                 REFERENCING NEW_TABLE AS N
>                 FOR EACH STATEMENT  
>                 INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
>                 SELECT 'I', V, ID, V FROM N
> ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.
> Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.
> TriggerTest shows this issue, see the comment with the bug number to reproduce.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512721 ] 

Bryan Pendleton commented on DERBY-2350:
----------------------------------------

What about "sniffing" the first few bytes of the string? To be a valid document,
it should either start with <?xml , possibly preceded by a bytemark, or < and a tag.

Not a perfect test by any means, but vastly less expensive than cranking up the XML parser.

> Use of XML values in the action statement of a trigger throw exceptions.
> ------------------------------------------------------------------------
>
>                 Key: DERBY-2350
>                 URL: https://issues.apache.org/jira/browse/DERBY-2350
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Attachments: d2350_v2.patch, derby-2350.diff
>
>
> A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.
> CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
>                 REFERENCING NEW_TABLE AS N
>                 FOR EACH STATEMENT  
>                 INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
>                 SELECT 'I', V, ID, V FROM N
> ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.
> Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.
> TriggerTest shows this issue, see the comment with the bug number to reproduce.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2350) Use of XML values in the action statement of a trigger throw exceptions.

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

Mike Matrigali updated DERBY-2350:
----------------------------------


I took a look at this issue.  I agree with the suggestion on the mentioned wiki that a good longterm solution in this area which would also fix this bug is to change the underlying trigger implementation to not be dependent on jdbc to get the old and new values for the
trigger actions.  My initial take is that such a change would be most appropriate for a new 
release not a bug fix in an existing release.  It would be nice to get XML working in triggers in 10.2 and 10.3 in the meantime, even if the solution is not the best.

The base problem for the bug seems to be that by default we use the jdbc getObject() call in the generated call to the old and new values.  From comments in 
CreateTriggerNode.java we generate "internal" sql of the following form for all the
datatypes:
/*
** Generate something like this:
**
**      cast (org.apache.derby.iapi.db.Factory::
**          getTriggerExecutionContext().getNewRow().
**              getObject(<colPosition>) AS DECIMAL(6,2))
**
** Column position is used to avoid the wrong column being
** selected problem (DERBY-1258) caused by the case insensitive
** JDBC rules for fetching a column by name.
**
** The cast back to the SQL Domain may seem redundant
** but we need it to make the column reference appear
** EXACTLY like a regular column reference, so we need
** the object in the SQL Domain and we need to have the
** type information.  Thus a user should be able to do
** something like
**
**      CREATE TRIGGER ... INSERT INTO T length(Column), ...
*/


The problem is that the jdbc being called does not support getObject on an XML object
and thus throws the exception.

I spent some time, and will post an example patch, looking at generating different code
for XML.  What I was looking at was generating the following in the case of XML rather
than the above:

          XMLPARSE(DOCUMENT
             CAST (org.apache.derby.iapi.db.Factory::
                  getTriggerExecutionContext().getNewRow().
                     getString(<colPosition>) AS CLOB)
                       PRESERVE WHITESPACE)

The patch I will post has this change and when I run the junit TriggerTest test it gets past the getObject() error but then gets the following which I have not yet figured out.  I believe
the parsing done by the XMLPARSE generated for the old/new reference is working, so
not quite sure where this error is coming from.  

...E
Time: 84.552
There was 1 error:
1) testTypesInActionStatement(org.apache.derbyTesting.functionTests.tests.lang.T
riggerTest)java.sql.SQLException: Values assigned to XML columns must be well-fo
rmed DOCUMENT nodes.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExcepti
onFactory.java:45)
    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:202)
    at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Tra
nsactionResourceImpl.java:391)
    at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Transa
ctionResourceImpl.java:346)
    at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnectio
n.java:1572)
    at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChil
d.java:81)
    at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement
.java:1293)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedP
reparedStatement.java:1652)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPrep
aredStatement.java:299)
    at org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.actionTypesI
nsertTest(TriggerTest.java:580)
    at org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.actionTypeTe
st(TriggerTest.java:445)
    at org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testTypesInA
ctionStatement(TriggerTest.java:427)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
:64)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
mpl.java:43)
    at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95)
    at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
    at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
    at junit.extensions.TestSetup.run(TestSetup.java:23)
    at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
Caused by: ERROR 2200L: Values assigned to XML columns must be well-formed DOCUM
ENT nodes.
    at org.apache.derby.iapi.error.StandardException.newException(StandardExcept
ion.java:280)
    at org.apache.derby.iapi.types.XML.normalize(XML.java:386)
    at org.apache.derby.iapi.types.DataTypeDescriptor.normalize(DataTypeDescript
or.java:505)
    at org.apache.derby.impl.sql.execute.NormalizeResultSet.normalizeRow(Normali
zeResultSet.java:330)
    at org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(Norma
lizeResultSet.java:189)
    at org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(DMLWri
teResultSet.java:125)
    at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.ja
va:496)
    at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPrepare
dStatement.java:370)
    at org.apache.derby.impl.sql.execute.GenericTriggerExecutor.executeSPS(Gener
icTriggerExecutor.java:173)
    at org.apache.derby.impl.sql.execute.StatementTriggerExecutor.fireTrigger(St
atementTriggerExecutor.java:80)
    at org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(Trigg
erEventActivator.java:278)
    at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Insert
ResultSet.java:1163)
    at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.ja
va:497)
    at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPrepare
dStatement.java:370)
    at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement
.java:1203)
    ... 26 more

FAILURES!!!
Tests run: 3,  Failures: 0,  Errors: 1





> Use of XML values in the action statement of a trigger throw exceptions.
> ------------------------------------------------------------------------
>
>                 Key: DERBY-2350
>                 URL: https://issues.apache.org/jira/browse/DERBY-2350
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Daniel John Debrunner
>
> A  trigger like, where V, V1 and V2 are columns of type XML will thrown an exception when fired.
> CREATE TRIGGER AIS AFTER INSERT ON T_MAIN 
>                 REFERENCING NEW_TABLE AS N
>                 FOR EACH STATEMENT  
>                 INSERT INTO T_ACTION_STATEMENT(A, V1, ID, V2) 
>                 SELECT 'I', V, ID, V FROM N
> ERROR 38000: The exception 'java.sql.SQLException: An attempt was made to get a data value of type 'java.lang.Object' from a data value of type 'XML'.' was thrown while evaluating an expression.
> Most likely because triggers are implementing using VTIs and hence JDBC ResultSets and XML is not supported through JDBC yet.
> TriggerTest shows this issue, see the comment with the bug number to reproduce.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.