Start of change

-20304   INVALID INDEX DEFINITION INVOLVING AN XMLPATTERN CLAUSE OR A COLUMN OF DATA TYPE XML. REASON CODE = reason-code

Explanation

A column defined with a data type of XML is included (or missing) in the columns for the index. The index definition is not valid for one of the following possible reason codes:
2
An XMLPATTERN clause is present but multiple index columns are specified.
4
An XMLPATTERN clause is present but the single index column specified is not defined with data type XML.
5
The path expression specified for the XMLPATTERN Clause does not start with a '/' or '//'.
6
The pattern expression does not have a name test or kind test following the '/'.
7
The pattern expression uses an unsupported axis in an axis step. Only forward axes child, attribute, descendant, self and descendant-or-self are supported.
8
The pattern expression specifies an invalid kind test or some syntax that is not a valid name test or kind test supported in a pattern expression.
9
The pattern expression specifies a predicate (an expression enclosed in square brackets). Predicates are not supported in a pattern expression of an XMLPATTERN clause.
10
The pattern expression includes XQuery syntax that is not supported in an XMLPATTERN clause and is not specifically covered by one of the other reason codes.
11
On a z/OS® database server, the pattern expression exceeds the limit of 50 steps if the pattern expression does not contain a function, or 44 steps if it contains a function.
12
The argument of the function in the pattern expression does not conform to the required syntax, or the index data type is not correct.

System action

The statement cannot be processed.

User response

Modify the statement based on the reason specified by the reason-code. Use one of the following suggestions to modify the statement:
2
If the index is intended as a key for XML data, ensure that only one column defined with a data type of XML is specified. Otherwise, remove the XMLPATTERN clause.
4
Either remove the XMLPATTERN clause or change the specified column to a single column defined with a data type of XML.
5
Ensure that the pattern expression begins with '/' or '//'. The XQuery syntax for which '/' or '//' is an abbreviation is not supported in the XMLPATTERN clause of the CREATE INDEX statement.
6
Add a name test or kind test following the '/' in the pattern expression.
7
Remove any reverse axes from the pattern expression. For example, 'parent::' must not be used as an axes in a pattern expression.
8
Check the pattern expression for kind tests or name tests that do not match the syntax specification of the XMLPATTERN clause of the CREATE INDEX statement. Correct or remove unsupported syntax.
9
Remove any predicates from the pattern expression in the XMLPATTERN clause.
10
Change the pattern expression to remove any syntax that is not valid according to the syntax specification of the XMLPATTERN clause of the CREATE INDEX statement. If the pattern expression includes an asterisk character (*), ensure that the name tests in the pattern expression correctly use the wildcard. If used with a Qname, there must be a colon before or after the wildcard character, otherwise it is considered a multiplication operator. Remove any attempt to use the asterisk as a multiplication operator from the pattern expression. You should also ensure that the XMLPATTERN clause does not include other XQuery operators, XQuery functions or XQuery FLWR (for, let, where, return) expressions.
11
Reduce the number of steps in the pattern expression. If the value that is to be indexed in the XML documents is longer than 50 steps when the pattern does not contain a function or longer than 44 steps when the pattern does contain a function, the index cannot be created.
12
Check the argument of the function in the pattern expression that does not conform to the required syntax of the XMLPATTERN clause of the CREATE INDEX statement, and check the index data type. Correct or remove unsupported syntax, or modify the index data type.

SQLSTATE

429BS

End of change