← Back to team overview

maria-developers team mailing list archive

Re: Why is ExtractValue() not allowed for virtual columns?

 

Henrik,

You are right, this function seems as deterministic as the rest of the string functions, that is, it still depends on the default character set and such.

I think the reason it is not allowed is that when this patch was considered/developed/reviewed, no systematic review of all the functions was made. When I did my own review (which resulted in bug #608641 , I forgot do consider XML functions).

I have added your observation to bug 608641, which list other deficiencies in mariadb virtual columns. My understanding is that the final decision was to release virtual columns as they are, and fix any deficiencies that occur as actual customer complaints in a future version.

Philip Stoev

----- Original Message ----- From: "Henrik Ingo" <henrik.ingo@xxxxxxxxxxxxx> To: "Maria Developers" <maria-developers@xxxxxxxxxxxxxxxxxxx>; "Philip Stoev" <pstoev@xxxxxxxxxxxx>; "Igor Babaev" <igor@xxxxxxxxxxxx>
Sent: Thursday, October 21, 2010 10:17 PM
Subject: 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

References