github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/pgwire/testdata/pgtest/notice (about)

     1  # Test notices work as expected by creating a VIEW on a TEMP TABLE.
     2  
     3  
     4  # Prepare the environment.
     5  
     6  send
     7  Query {"String": "DROP TABLE IF EXISTS t CASCADE"}
     8  ----
     9  
    10  until ignore=NoticeResponse
    11  ReadyForQuery
    12  ----
    13  {"Type":"CommandComplete","CommandTag":"DROP TABLE"}
    14  {"Type":"ReadyForQuery","TxStatus":"I"}
    15  
    16  # Start of test.
    17  
    18  send
    19  Query {"String": "CREATE TABLE t(x INT, y INT)"}
    20  ----
    21  
    22  until
    23  ReadyForQuery
    24  ----
    25  {"Type":"CommandComplete","CommandTag":"CREATE TABLE"}
    26  {"Type":"ReadyForQuery","TxStatus":"I"}
    27  
    28  send
    29  Query {"String": "CREATE INDEX t_x_idx ON t(x)"}
    30  ----
    31  
    32  until
    33  ReadyForQuery
    34  ----
    35  {"Type":"CommandComplete","CommandTag":"CREATE INDEX"}
    36  {"Type":"ReadyForQuery","TxStatus":"I"}
    37  
    38  send
    39  Query {"String": "CREATE INDEX t_y_idx ON t(y)"}
    40  ----
    41  
    42  until
    43  ReadyForQuery
    44  ----
    45  {"Type":"CommandComplete","CommandTag":"CREATE INDEX"}
    46  {"Type":"ReadyForQuery","TxStatus":"I"}
    47  
    48  
    49  # Check that crdb reports a notice upon drop index.
    50  
    51  send
    52  Query {"String": "DROP INDEX t_x_idx"}
    53  ----
    54  
    55  until crdb_only
    56  CommandComplete
    57  ----
    58  {"Severity":"NOTICE","Code":"00000","Message":"the data for dropped indexes is reclaimed asynchronously","Detail":"","Hint":"The reclamation delay can be customized in the zone configuration for the table.","Position":0,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"drop_index.go","Line":500,"Routine":"dropIndexByName","UnknownFields":null}
    59  {"Type":"CommandComplete","CommandTag":"DROP INDEX"}
    60  
    61  until noncrdb_only
    62  CommandComplete
    63  ----
    64  {"Type":"CommandComplete","CommandTag":"DROP INDEX"}
    65  
    66  until
    67  ReadyForQuery
    68  ----
    69  {"Type":"ReadyForQuery","TxStatus":"I"}
    70  
    71  # Disable notices and assert now it is not sent.
    72  send crdb_only
    73  Query {"String": "SET CLUSTER SETTING sql.notices.enabled = false"}
    74  ----
    75  
    76  until crdb_only
    77  ReadyForQuery
    78  ----
    79  {"Type":"CommandComplete","CommandTag":"SET CLUSTER SETTING"}
    80  {"Type":"ReadyForQuery","TxStatus":"I"}
    81  
    82  # Check that the notice is not printed any more.
    83  
    84  send
    85  Query {"String": "DROP INDEX t_y_idx"}
    86  ----
    87  
    88  until
    89  ReadyForQuery
    90  ----
    91  {"Type":"CommandComplete","CommandTag":"DROP INDEX"}
    92  {"Type":"ReadyForQuery","TxStatus":"I"}