Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 86858 | Differences between
and this patch

Collapse All | Expand All

(-)sqlite-3.2.0.orig/src/alter.c (-1 / +3 lines)
Lines 521-527 Link Here
521
  if( !pNew ) goto exit_begin_add_column;
521
  if( !pNew ) goto exit_begin_add_column;
522
  pParse->pNewTable = pNew;
522
  pParse->pNewTable = pNew;
523
  pNew->nCol = pTab->nCol;
523
  pNew->nCol = pTab->nCol;
524
  nAlloc = ((pNew->nCol)/8)+8;
524
  assert( pNew->nCol>0 );
525
  nAlloc = (((pNew->nCol-1)/8)*8)+8;
526
  assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 );
525
  pNew->aCol = (Column *)sqliteMalloc(sizeof(Column)*nAlloc);
527
  pNew->aCol = (Column *)sqliteMalloc(sizeof(Column)*nAlloc);
526
  pNew->zName = sqliteStrDup(pTab->zName);
528
  pNew->zName = sqliteStrDup(pTab->zName);
527
  if( !pNew->aCol || !pNew->zName ){
529
  if( !pNew->aCol || !pNew->zName ){
(-)sqlite-3.2.0.orig/test/alter3.test (-3 / +28 lines)
Lines 13-31 Link Here
13
# file format change that may be used in the future to implement
13
# file format change that may be used in the future to implement
14
# "ALTER TABLE ... ADD COLUMN".
14
# "ALTER TABLE ... ADD COLUMN".
15
#
15
#
16
# $Id: alter3.test,v 1.3 2005/03/17 12:33:14 drh Exp $
16
# $Id: alter3.test,v 1.4 2005/03/27 01:56:31 danielk1977 Exp $
17
#
17
#
18
18
19
set testdir [file dirname $argv0]
19
set testdir [file dirname $argv0]
20
20
21
source $testdir/tester.tcl
22
21
# If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
23
# If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
22
ifcapable !altertable {
24
ifcapable !altertable {
23
  finish_test
25
  finish_test
24
  return
26
  return
25
}
27
}
26
28
27
source $testdir/tester.tcl
28
29
# Test Organisation:
29
# Test Organisation:
30
# ------------------
30
# ------------------
31
#
31
#
Lines 336-339 Link Here
336
  } {1}
336
  } {1}
337
}
337
}
338
338
339
# Ticket #1183 - Make sure adding columns to large tables does not cause
340
# memory corruption (as was the case before this bug was fixed).
341
do_test alter3-8.1 {
342
  execsql {
343
    CREATE TABLE t4(c1);
344
  }
345
} {}
346
do_test alter3-8.2 {
347
  set cols c1
348
  for {set i 2} {$i < 100} {incr i} {
349
    execsql "
350
      ALTER TABLE t4 ADD c$i
351
    "
352
    lappend cols c$i
353
  }
354
  set ::sql "CREATE TABLE t4([join $cols {, }])"
355
  list 
356
} {}
357
do_test alter3-8.2 {
358
  execsql {
359
    SELECT sql FROM sqlite_master WHERE name = 't4';
360
  }
361
} [list $::sql]
362
339
finish_test
363
finish_test
364

Return to bug 86858