multiple assignment problem

This forum is to report technical problems with Rel.
Post Reply
HughDarwen
Posts:121
Joined:Sat May 24, 2008 4:49 pm
multiple assignment problem

Post by HughDarwen » Sun Feb 17, 2013 4:33 pm

Against the database that I'll send a backup of privately (because can't get "upload attachment" to work), the following two multiple assignments are equivalent but only the first one works. In version 2, the first line inserts the empty set even though the given expression evaluates to the same relation as that shown as a literal in 1.

1.
insert ComposedBy rel{tup{Problem# '095a', FirstName 'Sebastian', LastName 'Nowacki' }} ,
insert Problem rel { tup { Problem# '095a' , DR 6 , Month 'January' , Year '2013' ,
NumberOfComposers NumberOfComposers from tuple from ( DTYprob where DTY# = 123 ) } } ,
delete DTYcomposer where DTY# = 123,
update DTYprob where ( DTY# = 123 ) ( NumberOfComposers := 0 ) ,
insert DTYforCP rel{tup{DTY# 123, Problem# '095a'}};

2.
insert ComposedBy ( extend DTYcomposer where DTY# = 123 add ( '095a' AS Problem# ) ) { all but DTY# } ,
insert Problem rel { tup { Problem# '095a' , DR 6 , Month 'January' , Year '2013' ,
NumberOfComposers NumberOfComposers from tuple from ( DTYprob where DTY# = 123 ) } } ,
delete DTYcomposer where DTY# = 123,
update DTYprob where ( DTY# = 123 ) ( NumberOfComposers := 0 ) ,
insert DTYforCP rel{tup{DTY# 123, Problem# '095a'}};

Hugh Darwen

Dave
Site Admin
Posts:368
Joined:Sun Nov 27, 2005 7:19 pm

Re: multiple assignment problem

Post by Dave » Sun Feb 17, 2013 8:39 pm

I'll dig into this tomorrow, and should have a solution in a few days.

Dave
Site Admin
Posts:368
Joined:Sun Nov 27, 2005 7:19 pm

Re: multiple assignment problem

Post by Dave » Sat Feb 23, 2013 2:33 am

I've produced what I hope is a fix, but as the next Rel release requires DBE syntax, I've converted your database backup script to the new syntax. Both multiple assignments result in the following:

ERROR: Update will cause CONSTRAINT RightNumberOfComposers to fail.

It points to "insert DTYforCP rel {tup{DTY# 123, Problem# '095a'}};" as the failing update. Is this to be expected for the given data? I'd be inclined to assume not, but thought I'd best check.

Dave
Site Admin
Posts:368
Joined:Sun Nov 27, 2005 7:19 pm

Re: multiple assignment problem

Post by Dave » Sat Feb 23, 2013 6:36 pm

Please ignore my last post. There was still a bug, which I've now fixed. The problem with the first multiple assignment has been fixed in the soon-to-be-released version 1.0.10 update.

Dave
Site Admin
Posts:368
Joined:Sun Nov 27, 2005 7:19 pm

Re: multiple assignment problem

Post by Dave » Tue Feb 26, 2013 3:47 pm

The fix for this is now available in the version 1.0.10 update.

Post Reply