SQLite

Check-in [9ef69d1839]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Experimental change to apply affinity before running CHECK constraints on an INSERT. Note that in the CHECK constraints, REAL affinity really is REAL affinity, and not numeric affinity. This causes failures in some tests that are assuming affinity is applied after CHECK constraints.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | apply-affinity-first
Files: files | file ages | folders
SHA3-256: 9ef69d183927a26b293907e09d2e1d03c4125315178801d839cc64a50d1877af
User & Date: drh 2019-03-20 20:27:20.721
Context
2019-03-20
20:27
Experimental change to apply affinity before running CHECK constraints on an INSERT. Note that in the CHECK constraints, REAL affinity really is REAL affinity, and not numeric affinity. This causes failures in some tests that are assuming affinity is applied after CHECK constraints. (Leaf check-in: 9ef69d1839 user: drh tags: apply-affinity-first)
18:22
In the CLI, give better error messages if something goes wrong with the ".dbinfo" command. (check-in: 3649a77b79 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/insert.c.
1392
1393
1394
1395
1396
1397
1398

1399
1400








1401
1402
1403
1404
1405
1406
1407
  }

  /* Test all CHECK constraints
  */
#ifndef SQLITE_OMIT_CHECK
  if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
    ExprList *pCheck = pTab->pCheck;

    pParse->iSelfTab = -(regNewData+1);
    onError = overrideError!=OE_Default ? overrideError : OE_Abort;








    for(i=0; i<pCheck->nExpr; i++){
      int allOk;
      Expr *pExpr = pCheck->a[i].pExpr;
      if( aiChng
       && !sqlite3ExprReferencesUpdatedColumn(pExpr, aiChng, pkChng)
      ){
        /* The check constraints do not reference any of the columns being







>


>
>
>
>
>
>
>
>







1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
  }

  /* Test all CHECK constraints
  */
#ifndef SQLITE_OMIT_CHECK
  if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
    ExprList *pCheck = pTab->pCheck;
    VdbeOp *pOp;
    pParse->iSelfTab = -(regNewData+1);
    onError = overrideError!=OE_Default ? overrideError : OE_Abort;
    sqlite3TableAffinity(v, pTab, regNewData+1);
    pOp = sqlite3VdbeGetOp(v, -1);
    if( pOp->opcode==OP_Affinity && pOp->p4.z!=0 ){
      const char *zAff = pOp->p4.z;
      for(i=0; zAff[i]; i++){
        if( zAff[i]=='E' ) sqlite3VdbeAddOp1(v,OP_RealAffinity,regNewData+i+1);
      }
    }
    for(i=0; i<pCheck->nExpr; i++){
      int allOk;
      Expr *pExpr = pCheck->a[i].pExpr;
      if( aiChng
       && !sqlite3ExprReferencesUpdatedColumn(pExpr, aiChng, pkChng)
      ){
        /* The check constraints do not reference any of the columns being