github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/tests/all_mode/data/db3.increment.sql (about)

     1  use all_mode;
     2  
     3  insert into t_extract(j)values ('{"a":1, "b": {"a":1}}');
     4  insert into t_extract(j)values ('{"a":1, "b": [1,2,3]}');
     5  insert into t_extract(j)values ('[1,2]');
     6  insert into t_extract(j)values ('true');
     7  insert into t_extract(j)values ('false');
     8  insert into t_extract(j)values (null);
     9  insert into t_extract(j)values ('"string"');
    10  insert into t_extract(j)values ('1');
    11  insert into t_extract(j)values ('3.14');
    12  insert into t_extract(j)values ('{"a":1, "b": {"a":1}, "c": "string"}');
    13  
    14  alter table t_extract add column alt_a  int as (j ->> '$.a');
    15  alter table t_extract add column alt_b  char(10) as (j ->> '$.b');
    16  alter table t_extract add column alt_j1 json as (json_search(j, 'one', '1'));
    17  alter table t_extract add column alt_j2 json as (json_array(j ->> '$.a', j ->> '$.b'));
    18  alter table t_extract add column alt_j3 json as (json_object('a', j ->> '$.a', 'b', j ->> '$.b'));
    19  alter table t_extract add column alt_j4 json as (json_merge_preserve(b, '{"k": "v"}'));
    20  alter table t_extract add column alt_j5 json as (json_merge_patch(b, '{"k": "v"}'));
    21  alter table t_extract add column alt_j7 json as (json_set(b, '$.k', 'v'));
    22  alter table t_extract add column alt_j8 json as (json_insert(b, '$.k', 'v'));
    23  alter table t_extract add column alt_j9 json as (json_replace(b, '$.k', 'v'));
    24  alter table t_extract add column alt_j10 json as (json_remove(b, '$.k'));
    25  alter table t_extract add column alt_j11 int as (json_contains(b, '{"k": "v"}'));
    26  alter table t_extract add column alt_j12 int as (json_contains_path(b, 'one', '$.k'));
    27  alter table t_extract add column alt_j13 json as (json_array_append(b, '$[0]', 'v'));
    28  alter table t_extract add column alt_j14 json as (json_array_insert(j3, '$[0]', 'v'));
    29  
    30  insert into t_extract(j)values ('{"a":1, "b": {"a":1}}');
    31  insert into t_extract(j)values ('{"a":1, "b": [1,2,3]}');
    32  insert into t_extract(j)values ('[1,2]');
    33  insert into t_extract(j)values ('true');
    34  insert into t_extract(j)values ('false');
    35  insert into t_extract(j)values (null);
    36  insert into t_extract(j)values ('"string"');
    37  insert into t_extract(j)values ('1');
    38  insert into t_extract(j)values ('3.14');
    39  insert into t_extract(j)values ('{"a":1, "b": {"a":1}, "c": "string"}');