Product Documentation

SQL Operations Guide

Previous Topic

Next Topic

ctsqlimp Import Indexes with Segment on String Field Missing Last Byte

A fairly common situation C programmers may encounter is that the last byte from an index segment is usually assumed to be ‘\0’ (nul), when in fact it is not. The index segment then does not match the entire field (many times based on a CT_FSTRING).

There have been inquiries about importing into FairCom DB SQL indexes where a segment is on a string field, however, it is missing the last byte. While this is atypical usage, with c-tree technology there is no actual problem in allowing these indexes.

The FairCom DB SQL can map an index segment into a field even if the segment does not match the entire field and to properly perform the segment low-level handling. No check is made on the “nature” of the partial segment. It is up to the import utility to verify the index is proper for FairCom DB SQL handling.

The feature itself is off by default and is activated with the SQL_OPTION PARTIAL_SEG server configuration keyword.

Note: The only way FairCom DB SQL may be aware of an index using a partial segment is because this index has been imported by ctsqlimp. Using an index with partial segment imported with ctsqlimp without the SQL_OPTION PARTIAL_SEG turned on results in a CTDBRET_NOTFIELD error.


Logic was added to the ctsqlimp utility to import indexes with segment on string field missing the last byte.

Note: This feature is turned on with the -z command line switch and requires a server with SQL_OPTION PARTIAL_SEG turned on.