SQLite Forum

Bug in .import --skip (v3.33.0, trunk)

Bug in .import --skip (v3.33.0, trunk)

(1) By Wolfgang Oertl (w.oertl) on 2020-07-03 19:26:52 [source]

I noted that when using the new --skip option for the shell's .import command, the line numbers are incorrect. The reason is that while skipping, xRead (either ascii_read_one_field or csv_read_one_field) increments ImportCtx.nLine, and the loop to skip lines does it too:


while( (nSkip--)>0 ){
  while( xRead(&sCtx) && sCtx.cTerm==sCtx.cColSep ){}

The line numbers reported in error messages and (when using -v) the number of used lines are too high by the number of skipped lines.

The fix is, of course, to remove the sCtx.nLine++ statement.

The --skip option does not complain about negative values or otherwise unparseable values.

(2) By Larry Brasfield (LarryBrasfield) on 2020-07-04 01:59:12 in reply to 1 [link] [source]

The incorrect line numbers flaw was fixed today, on the trunk. The next pre-release snapshot should have it.

I'm sure the fixer appreciates such clear error reports. Slightly more helpful would be bug demonstration steps written in the shell's input format. (Not criticizing, just noting for future action.)