13. The non-transitory computer-readable storage medium of claim 8 , wherein the view returns relational scalar attributes generated from a XML source.
8. A non-transitory computer-readable storage medium storing one or more sequences of instructions which, when executed by one or more processors, causes the one or more processors to perform: a database server receiving a certain query, wherein said certain query references a view; in response to receiving said certain auery said database server: determining whether or not to defer a XML rewrite of a certain query until after performing a view merge of said certain query; in response to determining to defer said XML rewrite of said certain query: performing a view merge of said certain query; and subsequent to performing said view merge of said certain query, performing said XML rewrite of said certain query; in response to determining not to defer said XML rewrite of said certain query, performing said XML rewrite; and subsequent to performing said XML rewrite, performing said view merge of said certain query; and executing said certain query.