SQLite

Check-in [928f973ca9]
Login

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

Overview
Comment:Make sure errors in coding triggers are propagated back up to the parser.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 928f973ca9adc7933015b2fb6b6fcb8e3154cb9c
User & Date: drh 2015-04-16 15:47:06.148
Context
2015-04-16
16:04
Silently ignore requests to change the PRAGMA synchronous setting to an illegal integer value, rather than raising an assertion. (check-in: e0a88176fc user: drh tags: trunk)
15:47
Make sure errors in coding triggers are propagated back up to the parser. (check-in: 928f973ca9 user: drh tags: trunk)
15:05
Add the --backslash option to the command-line shell for testing purposes. (check-in: dd96211e80 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/trigger.c.
791
792
793
794
795
796
797

798
799
800
801
802
803
804
*/
static void transferParseError(Parse *pTo, Parse *pFrom){
  assert( pFrom->zErrMsg==0 || pFrom->nErr );
  assert( pTo->zErrMsg==0 || pTo->nErr );
  if( pTo->nErr==0 ){
    pTo->zErrMsg = pFrom->zErrMsg;
    pTo->nErr = pFrom->nErr;

  }else{
    sqlite3DbFree(pFrom->db, pFrom->zErrMsg);
  }
}

/*
** Create and populate a new TriggerPrg object with a sub-program 







>







791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
*/
static void transferParseError(Parse *pTo, Parse *pFrom){
  assert( pFrom->zErrMsg==0 || pFrom->nErr );
  assert( pTo->zErrMsg==0 || pTo->nErr );
  if( pTo->nErr==0 ){
    pTo->zErrMsg = pFrom->zErrMsg;
    pTo->nErr = pFrom->nErr;
    pTo->rc = pFrom->rc;
  }else{
    sqlite3DbFree(pFrom->db, pFrom->zErrMsg);
  }
}

/*
** Create and populate a new TriggerPrg object with a sub-program 
Changes to test/fkey2.test.
2009
2010
2011
2012
2013
2014
2015














2016
2017
  }
} {1 {FOREIGN KEY constraint failed}}
do_test fkey2-ce7c13.1.6 {
  catchsql {
    UPDATE tce73 set a = 101 where a = 100;
  }
} {1 {FOREIGN KEY constraint failed}}















finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>


2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
  }
} {1 {FOREIGN KEY constraint failed}}
do_test fkey2-ce7c13.1.6 {
  catchsql {
    UPDATE tce73 set a = 101 where a = 100;
  }
} {1 {FOREIGN KEY constraint failed}}

# 2015-04-16:  Foreign key errors propagate back up to the parser.
#
do_test fkey2-20150416-100 {
  db close
  sqlite3 db :memory:
  catchsql {
    PRAGMA foreign_keys=1;
    CREATE TABLE t1(x PRIMARY KEY);
    CREATE TABLE t(y REFERENCES t0(x)ON DELETE SET DEFAULT);
    CREATE TABLE t0(y REFERENCES t1 ON DELETE SET NULL);
    REPLACE INTO t1 SELECT(0);CREATE TABLE t2(x);CREATE TABLE t3;
  }
} {1 {foreign key mismatch - "t" referencing "t0"}}

finish_test