How Does One Update a Relation in a Relation

This forum is for any questions about the language Tutorial D or the Rel implementation of it.
Post Reply
Blake
Posts: 9
Joined: Tue Jun 07, 2011 9:08 pm

How Does One Update a Relation in a Relation

Post 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?
Dave
Site Admin
Posts: 372
Joined: Sun Nov 27, 2005 7:19 pm

Re: How Does One Update a Relation in a Relation

Post 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.
Post Reply