Hi All,

I have written a couple of emails about this JDB bug but was not too
sure if it was a bug or just my lack of understanding. I think the
output below shows very clearly that there is definitely a bug when
trying to make a compound primary key whose columns reference another
table. The code below results in duplicate values in a table which
should only contain unique rows.

The fact that at the end of the script the Reads__ command does not
report row 'A';'B' as being in the table, but that further attempts to
Insert__ 'A';'B' fail with duplicate key error might give a hint as to
where the problem is. Insert__ might be doing the correct thing but it
might be using Reads__ somewhere to find what is in the table already.
It might be Reads__ that is not be working correctly.

Thanks,
Matthew.


   load 'data/jdb'

   ffd =: Open_jdb_ jpath , '~temp'
   db =: Create__ffd 'db16'

   NB. Table of unique varchar
   Create__db 'mytype';0 : 0
value varchar;
)
+-+
|5|
+-+

   Insert__db 'mytype';<<'A';'B'

   NB. table of unique pairs of references to table mytype
   Create__db 'uniquemtpair';0 : 0
v1 mytype
v2 mytype;
)
+-+
|6|
+-+

   NB. Insert__ bug is here:
   Insert__db 'uniquemtpair';<'A';'B'
   Reads__db 'from uniquemtpair'
+--+--+
|v1|v2|
+--+--+
|A |A |
+--+--+

   NB. Duplicate has been inserted?
   Insert__db 'uniquemtpair';<'A';'A'
   Reads__db 'from uniquemtpair'
+--+--+
|v1|v2|
+--+--+
|A |A |
|A |A |
+--+--+

   NB. But this gives a duplicate error:
   Insert__db 'uniquemtpair';<'A';'B'
|101 Duplicate values in columns: v1,v2

values: 1,2: throw
|       throw'101 Duplicate values in columns: ',msg
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to