Page 1 of 1

multiple assignment problem

Posted: Sun Feb 17, 2013 4:33 pm
by HughDarwen
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

Re: multiple assignment problem

Posted: Sun Feb 17, 2013 8:39 pm
by Dave
I'll dig into this tomorrow, and should have a solution in a few days.

Re: multiple assignment problem

Posted: Sat Feb 23, 2013 2:33 am
by Dave
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.

Re: multiple assignment problem

Posted: Sat Feb 23, 2013 6:36 pm
by Dave
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.

Re: multiple assignment problem

Posted: Tue Feb 26, 2013 3:47 pm
by Dave
The fix for this is now available in the version 1.0.10 update.