Page 1 of 1

How Does One Update a Relation in a Relation

Posted: Thu Nov 10, 2011 3:37 am
by Blake
It seems like I should be able to do something like this:

Code: Select all

update x where a = 1 ( update b  (c := 33) );
With the following relvar:

Code: Select all

var x private relation { a integer, b relation { c integer }} init ( relation {tuple {a 1, b relation {tuple {c 2}}}}) key {a};
But I just get an error: "ERROR: Expected a relation-valued variable in UPDATE ... WHERE"

What should I be trying?

Re: How Does One Update a Relation in a Relation

Posted: Thu Nov 10, 2011 10:59 am
by Dave
In principle, the following should work:

Code: Select all

update x where a = 1 ( b := update (b) ( c := 33 ) );
However, it has a bug! :( You'll probably get something like the following:

ERROR: '%tuple32' has not been defined.

I'll work on fixing this.