SQLite

Check-in [0e0c23fc]
Login

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

Overview
Comment:Fix a faulty JSON assert() added 30 days ago by check-in [7b8ea2298927fd34]. dbsqlfuzz f30366e7b02562398a387ddcc681422fd4251190.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0e0c23fcc493a5d6beb6ab9554981bbc36ba1554fea0f8ba78dc41738f4bd1c2
User & Date: drh 2021-11-15 01:45:11
Context
2021-11-15
13:22
Improved context shown for the "ABORT-due-to-error" output line when using "PRAGMA vdbe_debug=on" in an SQLITE_DEBUG build. (check-in: c7776369 user: drh tags: trunk)
01:45
Fix a faulty JSON assert() added 30 days ago by check-in [7b8ea2298927fd34]. dbsqlfuzz f30366e7b02562398a387ddcc681422fd4251190. (check-in: 0e0c23fc user: drh tags: trunk)
2021-11-12
14:39
Improved handling of OOM while reallocating a column name to add type information. dbsqlfuzz 5a195b4233649e49e0aa34f1b743ca192d85b198 (check-in: 5995dd4d user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/misc/json1.c.

1658
1659
1660
1661
1662
1663
1664
1665


1666

1667
1668
1669
1670
1671
1672
1673
        if( pPatch[i+1].eType==JSON_NULL ){
          pTarget[j+1].jnFlags |= JNODE_REMOVE;
        }else{
          JsonNode *pNew = jsonMergePatch(pParse, iTarget+j+1, &pPatch[i+1]);
          if( pNew==0 ) return 0;
          pTarget = &pParse->aNode[iTarget];
          if( pNew!=&pTarget[j+1] ){
            assert( pTarget[j+1].eU==0 || pTarget[j+1].eU==1 );


            testcase( pTarget[j+1].eU==1 );

            VVA( pTarget[j+1].eU = 5 );
            pTarget[j+1].u.pPatch = pNew;
            pTarget[j+1].jnFlags |= JNODE_PATCH;
          }
        }
        break;
      }







|
>
>

>







1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
        if( pPatch[i+1].eType==JSON_NULL ){
          pTarget[j+1].jnFlags |= JNODE_REMOVE;
        }else{
          JsonNode *pNew = jsonMergePatch(pParse, iTarget+j+1, &pPatch[i+1]);
          if( pNew==0 ) return 0;
          pTarget = &pParse->aNode[iTarget];
          if( pNew!=&pTarget[j+1] ){
            assert( pTarget[j+1].eU==0
                 || pTarget[j+1].eU==1
                 || pTarget[j+1].eU==2 );
            testcase( pTarget[j+1].eU==1 );
            testcase( pTarget[j+1].eU==2 );
            VVA( pTarget[j+1].eU = 5 );
            pTarget[j+1].u.pPatch = pNew;
            pTarget[j+1].jnFlags |= JNODE_PATCH;
          }
        }
        break;
      }

Changes to test/json104.test.

121
122
123
124
125
126
127



128
129
130
131
132
133
134
} {{{"e":null,"a":1}}}
do_execsql_test json104-313 {
  SELECT json_patch('[1,2]','{"a":"b","c":null}');
} {{{"a":"b"}}}
do_execsql_test json104-314 {
  SELECT json_patch('{}','{"a":{"bb":{"ccc":null}}}');
} {{{"a":{"bb":{}}}}}




#-------------------------------------------------------------------------

do_execsql_test 401 {
  CREATE TABLE obj(x);
  INSERT INTO obj VALUES('{"a":1,"b":2}');
  SELECT * FROM obj;







>
>
>







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
} {{{"e":null,"a":1}}}
do_execsql_test json104-313 {
  SELECT json_patch('[1,2]','{"a":"b","c":null}');
} {{{"a":"b"}}}
do_execsql_test json104-314 {
  SELECT json_patch('{}','{"a":{"bb":{"ccc":null}}}');
} {{{"a":{"bb":{}}}}}
do_execsql_test json104-320 {
  SELECT json_patch('{"x":{"one":1}}','{"x":{"two":2},"x":"three"}');
} {{{"x":"three"}}}

#-------------------------------------------------------------------------

do_execsql_test 401 {
  CREATE TABLE obj(x);
  INSERT INTO obj VALUES('{"a":1,"b":2}');
  SELECT * FROM obj;