Techniques for executing database commands include receiving a database
command that includes an XML component operation that operates on an XML
construct that is based on a first set of one or more relational database
constructs. It is determined whether the XML component operation can be
transformed to a relational database operation on a particular set of one
or more relational database constructs of the first set, which does not
involve the XML component operation. If it is determined that the XML
component operation can be transformed, then the XML component operation
is rewritten as a particular relational database operation that operates
on the particular set and that does not involve the XML component
operation. The particular relational database operation is evaluated. In
another aspect, techniques include determining a primitive set of XML
generation operations and replacing non-primitive XML generation
operations with one or more operations from the primitive set.