Avoid a memory leak and/or assertion failure when parsing a table

declaration that contains a duplicate column name.
Ticket #1418. (CVS 2684)

FossilOrigin-Name: f43427742b1c086f2621c900f4ede1a34a8b44ee
This commit is contained in:
drh 2005-09-10 15:35:06 +00:00
parent 3dec223ca0
commit d891967052
4 changed files with 16 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Use\sof\sthe\sCROSS\skeyword\sin\sa\sjoin\sprevents\stable\sreordering.\s\sTicket\s#1414.\s(CVS\s2683)
D 2005-09-10T15:28:09
C Avoid\sa\smemory\sleak\sand/or\sassertion\sfailure\swhen\sparsing\sa\stable\r\ndeclaration\sthat\scontains\sa\sduplicate\scolumn\sname.\r\nTicket\s#1418.\s(CVS\s2684)
D 2005-09-10T15:35:07
F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -34,7 +34,7 @@ F src/attach.c 4b21689700a72ae281fa85dbaff06b2a62bd49ee
F src/auth.c 31e2304bef67f44d635655f44234387ea7d21454
F src/btree.c a1ee183067f20eb5ba33ca45ed47acbc7214fe44
F src/btree.h 1ed561263ca0e335bc3e81d761c9d5ff8c22f61e
F src/build.c 86181cbd89e67e99d0f235428d3b9640ccf17101
F src/build.c db063dc322fb18227833c7c41152aac314ef347c
F src/callback.c 9a1162c8f9dae9fad6d548339669aacb5f6cf76b
F src/complete.c 4de937dfdd4c79a501772ab2035b26082f337a79
F src/date.c 7444b0900a28da77e57e3337a636873cff0ae940
@ -208,7 +208,7 @@ F test/sort.test 0c33a8ae1c238377ad197387c3872175f40d3843
F test/subquery.test e6de53332c0301b3cfa34edc3f3cd5fa1e859efd
F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2
F test/sync.test d769caaec48456119316775e35e0fdee2fa852d7
F test/table.test d0e05ede3f6e5a8b79f8661ddcc4618cf7e69f8a
F test/table.test ec0e6c2186bb8f6824f470caa118524dfd8fe057
F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
F test/tclsqlite.test 2da3e4b3a79b13c1511c9d0cd995e08f8362e782
F test/temptable.test 7927261befdbc7b0a7ffebb85ecc70a74fa7b15b
@ -306,7 +306,7 @@ F www/tclsqlite.tcl 3df553505b6efcad08f91e9b975deb2e6c9bb955
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 0288fa5d25886f6fbef0be782f12285d62bebd68
R f8eceac70392349128d8b83ed9d12654
P 415b8b24629aa12756d8285c094b5f85d8a8e532
R 235cc9d948e051600520eade7dbee36c
U drh
Z 461ac5bc1124c76e7cb4172bfe8587a8
Z be7b5a2752d3ffcf1cf1e2330b39e495

View File

@ -1 +1 @@
415b8b24629aa12756d8285c094b5f85d8a8e532
f43427742b1c086f2621c900f4ede1a34a8b44ee

View File

@ -22,7 +22,7 @@
** COMMIT
** ROLLBACK
**
** $Id: build.c,v 1.347 2005/09/08 14:17:20 drh Exp $
** $Id: build.c,v 1.348 2005/09/10 15:35:07 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -940,7 +940,7 @@ void sqlite3AddColumnType(Parse *pParse, Token *pType){
i = p->nCol-1;
if( i<0 ) return;
pCol = &p->aCol[i];
assert( pCol->zType==0 );
sqliteFree(pCol->zType);
pCol->zType = sqlite3NameFromToken(pType);
pCol->affinity = sqlite3AffinityType(pType);
}

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE TABLE statement.
#
# $Id: table.test,v 1.40 2005/08/13 00:56:28 drh Exp $
# $Id: table.test,v 1.41 2005/09/10 15:35:07 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -388,6 +388,11 @@ do_test table-9.1 {
CREATE TABLE t6(a,b,a);
}
} {1 {duplicate column name: a}}
do_test table-9.2 {
catchsql {
CREATE TABLE t6(a varchar(100), b blob, a integer);
}
} {1 {duplicate column name: a}}
# Check the foreign key syntax.
#