github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/logictest/testdata/logic_test/column_families (about)

     1  # LogicTest: local local-vec-auto
     2  
     3  # Test that different operations still succeed when the primary key is not in column family 0.
     4  
     5  statement ok
     6  CREATE TABLE t (x INT PRIMARY KEY, y INT, z INT, FAMILY (y), FAMILY (z), FAMILY (x));
     7  INSERT INTO t VALUES (1, 2, 3), (4, 5, 6)
     8  
     9  query III rowsort
    10  SELECT * FROM t
    11  ----
    12  1 2 3
    13  4 5 6
    14  
    15  statement ok
    16  UPDATE t SET x = 2 WHERE y = 2
    17  
    18  query III rowsort
    19  SELECT * FROM t
    20  ----
    21  2 2 3
    22  4 5 6
    23  
    24  statement ok
    25  UPDATE t SET z = 3 WHERE x = 4
    26  
    27  query III rowsort
    28  SELECT * FROM t
    29  ----
    30  2 2 3
    31  4 5 3
    32  
    33  query II
    34  SELECT y, z FROM t WHERE x = 2
    35  ----
    36  2 3
    37  
    38  statement ok
    39  DROP TABLE t;
    40  CREATE TABLE t (x DECIMAL PRIMARY KEY, y INT, FAMILY (y), FAMILY (x));
    41  INSERT INTO t VALUES (5.607, 1), (5.6007, 2)
    42  
    43  query TI rowsort
    44  SELECT * FROM t
    45  ----
    46  5.607 1
    47  5.6007 2
    48  
    49  # Ensure that primary indexes with encoded composite values that are not in family 0 have their
    50  # composite values stored in the corresponding family.
    51  
    52  statement ok
    53  DROP TABLE t;
    54  CREATE TABLE t (x DECIMAL, y DECIMAL, z INT, FAMILY (z), FAMILY (y), FAMILY (x), PRIMARY KEY (x, y));
    55  INSERT INTO t VALUES (1.00, 2.00, 1)
    56  
    57  query TTI
    58  SET tracing=on,kv,results;
    59  SELECT * FROM t;
    60  SET tracing=off
    61  ----
    62  1.00 2.00 1
    63  
    64  query T
    65  SELECT message FROM [SHOW KV TRACE FOR SESSION] WHERE
    66  message LIKE 'fetched: /t/primary/%'
    67  ORDER BY message
    68  ----
    69  fetched: /t/primary/1/2.00/x -> /1.00
    70  fetched: /t/primary/1/2/y -> /2.00
    71  fetched: /t/primary/1/2/z -> /1