1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix an issue with RETURNING from UPSERT.

FossilOrigin-Name: 757b74ba0fd64634a365bd73955181191767ad8816a33a362e32ece250299a51
This commit is contained in:
drh
2021-02-04 21:17:12 +00:00
parent 552562c48f
commit e1db9343d5
3 changed files with 12 additions and 12 deletions

View File

@@ -857,7 +857,7 @@ static ExprList *sqlite3ExpandReturning(
}
}
}
if( !db->mallocFailed ){
if( !db->mallocFailed && !pParse->colNamesSet ){
Vdbe *v = pParse->pVdbe;
assert( v!=0 );
sqlite3VdbeSetNumCols(v, pNew->nExpr);
@@ -888,14 +888,14 @@ static void codeReturningTrigger(
assert( pParse->bReturning );
pReturning = pParse->u1.pReturning;
assert( pTrigger == &(pReturning->retTrig) );
sqlite3VdbeAddOp0(v, OP_Noop);
VdbeComment((v, "RETURNING trigger goes here"));
pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab);
if( pNew ){
NameContext sNC;
memset(&sNC, 0, sizeof(sNC));
pReturning->nRetCol = pNew->nExpr;
pReturning->iRetCur = pParse->nTab++;
if( pReturning->nRetCol==0 ){
pReturning->nRetCol = pNew->nExpr;
pReturning->iRetCur = pParse->nTab++;
}
sNC.pParse = pParse;
sNC.uNC.iBaseReg = regIn;
sNC.ncFlags = NC_UBaseReg;