> WT_ASSERT(session, strcmp(cursor->key_format, "r") != 0);
>
> If a valid application can do this, should we change the ASSERT into an error message?
A valid application can't hit this assert – key_format is determined when the index is created, this is just a sanity check when opening an index.
However, the error here isn't what I would have expected:
$ rm -rf WT_TEST && mkdir WT_TEST $ ./wt -h WT_TEST create -c 'key_format=r,columns=(k,v)' table:t $ ./wt -h WT_TEST create -c 'columns=(k)' index:t:k file:t_k.wti [session.create]: fixed-width field sizes must be greater than 0 and less than or equal to 8: Invalid argument
The relevant part of the call stack is here:
WT-5 0x000000010007250b in __create_file (session=0x1008009e0, uri=0x100103390 "file:t_k.wti", exclusive=0, config=0x100102be0 "columns=(k),value_format,key_format=r") at schema_create.c:77 WT-6 0x0000000100073868 in __create_index (session=0x1008009e0, name=0x100102870 "index:t:k", exclusive=0, config=0x7fff5fbff9c7 "columns=(k)") at schema_create.c:282 WT-7 0x000000010007401e in __wt_schema_create (session=0x1008009e0, name=0x100102870 "index:t:k", config=0x7fff5fbff9c7 "columns=(k)") at schema_create.c:397
After the call to *wt_struct_reformat in *create_index, if the calculated key_format is "r", it should generate a sane error message there instead (i.e., "WiredTiger does not support primary key indices on column stores").