1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-19 21:43:15 +03:00

Bug fixes in the VIEW implementation. (CVS 396)

FossilOrigin-Name: 668ef6380eba256ef82477b63aef850249a619a0
This commit is contained in:
drh
2002-02-27 01:47:11 +00:00
parent a2ed56016f
commit ff78bd2f07
8 changed files with 222 additions and 28 deletions

View File

@@ -25,7 +25,7 @@
** ROLLBACK
** PRAGMA
**
** $Id: build.c,v 1.79 2002/02/23 02:32:10 drh Exp $
** $Id: build.c,v 1.80 2002/02/27 01:47:12 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -824,6 +824,7 @@ void sqliteCreateView(
pSelTab->nCol = 0;
pSelTab->aCol = 0;
sqliteDeleteTable(0, pSelTab);
sqliteSelectUnbind(pSelect);
sEnd = pParse->sLastToken;
if( sEnd.z[0]!=0 && sEnd.z[0]!=';' ){
sEnd.z += sEnd.n;
@@ -1341,22 +1342,15 @@ void sqliteIdListDelete(IdList *pList){
for(i=0; i<pList->nId; i++){
sqliteFree(pList->a[i].zName);
sqliteFree(pList->a[i].zAlias);
/* If the pSelect field is set and is not pointing to the Select
** structure that defines a VIEW, then the Select is for a subquery
** and should be deleted. Do not delete VIEWs, however.
*/
if( pList->a[i].pSelect &&
(pList->a[i].pTab==0 || pList->a[i].pTab->pSelect==0) ){
sqliteSelectDelete(pList->a[i].pSelect);
if( pList->a[i].pTab && pList->a[i].pTab->isTransient ){
sqliteDeleteTable(0, pList->a[i].pTab);
}
sqliteSelectDelete(pList->a[i].pSelect);
}
sqliteFree(pList->a);
sqliteFree(pList);
}
/*
** The COPY command is for compatibility with PostgreSQL and specificially
** for the ability to read the output of pg_dump. The format is as