multiple assignment problem
Posted: 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
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