← Back to team overview

maria-developers team mailing list archive

Why is ExtractValue() not allowed for virtual columns?

 

Philip, Igor

Why is ExtractValue() not allowed for a virtual column?

Why can't I do this:


CREATE TABLE sbtest (
   id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   doc TEXT,
   username varchar(10) as (ExtractValue(doc, '/user/username')) virtual,
   PRIMARY KEY (id),
)

...but can do this:

CREATE TABLE sbtest (
   id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   doc TEXT,
   username varchar(10) as (ExtractValue(doc, '/user/username')) virtual,
   PRIMARY KEY (id)
)

(Just for fun, imagine "doc" containing an xml document like
<user>
 <id>1</id>
 <username>hingo</username>
 <name>Henrik Ingo</name>
 <status time="2010-21-10 13:16">I'm writing an example XML document</status>
 <friends>
  <friend_id>9</friend_id>
  <friend_id>91</friend_id>
  <friend_id>92</friend_id>
  <friend_id>93</friend_id>
  <friend_id>94</friend_id>
  <friend_id>95</friend_id>
  <friend_id>96</friend_id>
  <friend_id>97</friend_id>
  <friend_id>98</friend_id>
  <friend_id>99</friend_id>
 </friend>
</user>
)


I don't see ExtractValue being in any way undeterministic or anything.

henrik

-- 
henrik.ingo@xxxxxxxxxxxxx
+358-40-5697354
www.openlife.cc



Follow ups