# LogicTest: default

query T colnames
SELECT * FROM [SHOW client_encoding]
----
client_encoding
UTF8

query T colnames
SELECT c.x FROM [SHOW client_encoding] AS c(x)
----
x
UTF8

query TI colnames
SELECT * FROM [SHOW client_encoding] WITH ORDINALITY
----
client_encoding     ordinality
UTF8                1

query TT colnames
SELECT * FROM [SHOW ALL]
----
variable                       value
application_name               ·
client_encoding                UTF8
client_min_messages            ·
database                       test
datestyle                      ISO
default_transaction_isolation  serializable
distsql                        off
extra_float_digits             ·
max_index_keys                 32
node_id                        1
search_path                    pg_catalog
server_version                 9.5.0
session_user                   root
sql_safe_updates               false
standard_conforming_strings    on
time zone                      UTC
tracing                        off
transaction_isolation          serializable
transaction_priority           normal
transaction_status             NoTxn

query I colnames
SELECT * FROM [SHOW CLUSTER SETTING sql.defaults.distsql]
----
sql.defaults.distsql
0

query TTTT colnames
SELECT * FROM [SHOW ALL CLUSTER SETTINGS] WHERE name != 'diagnostics.reporting.enabled'
----
name                                               current_value  type  description
cluster.organization                               ·              s     organization name
diagnostics.reporting.interval                     1h0m0s         d     interval at which diagnostics data should be reported
diagnostics.reporting.report_metrics               true           b     enable collection and reporting diagnostic metrics to cockroach labs
diagnostics.reporting.send_crash_reports           true           b     send crash and panic reports
kv.allocator.lease_rebalancing_aggressiveness      1E+00          f     set greater than 1.0 to rebalance leases toward load more aggressively, or between 0 and 1.0 to be more conservative about rebalancing leases
kv.allocator.load_based_lease_rebalancing.enabled  true           b     set to enable rebalancing of range leases based on load and latency
kv.allocator.range_rebalance_threshold             5E-02          f     minimum fraction away from the mean a store's range count can be before it is considered overfull or underfull
kv.allocator.stat_based_rebalancing.enabled        false          b     set to enable rebalancing of range replicas based on write load and disk usage
kv.allocator.stat_rebalance_threshold              2E-01          f     minimum fraction away from the mean a store's stats (like disk usage or writes per second) can be before it is considered overfull or underfull
kv.bulk_io_write.max_rate                          8.0 EiB        z     the rate limit (bytes/sec) to use for writes to disk on behalf of bulk io ops
kv.gc.batch_size                                   100000         i     maximum number of keys in a batch for MVCC garbage collection
kv.raft.command.max_size                           64 MiB         z     maximum size of a raft command
kv.raft_log.synchronize                            true           b     set to true to synchronize on Raft log writes to persistent storage
kv.range_descriptor_cache.size                     1000000        i     maximum number of entries in the range descriptor and leaseholder caches
kv.snapshot_rebalance.max_rate                     2.0 MiB        z     the rate limit (bytes/sec) to use for rebalance snapshots
kv.snapshot_recovery.max_rate                      8.0 MiB        z     the rate limit (bytes/sec) to use for recovery snapshots
kv.transaction.max_intents                         100000         i     maximum number of write intents allowed for a KV transaction
rocksdb.min_wal_sync_interval                      0s             d     minimum duration between syncs of the RocksDB WAL
server.consistency_check.interval                  24h0m0s        d     the time between range consistency checks; set to 0 to disable consistency checking
server.declined_reservation_timeout                1s             d     the amount of time to consider the store throttled for up-replication after a reservation was declined
server.failed_reservation_timeout                  5s             d     the amount of time to consider the store throttled for up-replication after a failed reservation call
server.remote_debugging.mode                       local          s     set to enable remote debugging, localhost-only or disable (any, local, off)
server.time_until_store_dead                       5m0s           d     the time after which if there is no new gossiped information about a store, it is considered dead
server.web_session_timeout                         168h0m0s       d     the duration that a newly created web session will be valid
sql.defaults.distsql                               0              e     Default distributed SQL execution mode [off = 0, auto = 1, on = 2]
sql.distsql.distribute_index_joins                 true           b     if set, for index joins we instantiate a join reader on every node that has a stream; if not set, we use a single join reader
sql.distsql.merge_joins.enabled                    true           b     if set, we plan merge joins when possible
sql.distsql.temp_storage.joins                     true           b     set to true to enable use of disk for distributed sql joins
sql.distsql.temp_storage.sorts                     true           b     set to true to enable use of disk for distributed sql sorts
sql.distsql.temp_storage.workmem                   64 MiB         z     maximum amount of memory in bytes a processor can use before falling back to temp storage
sql.metrics.statement_details.dump_to_logs         false          b     dump collected statement statistics to node logs when periodically cleared
sql.metrics.statement_details.enabled              true           b     collect per-statement query statistics
sql.metrics.statement_details.threshold            0s             d     minimum execution time to cause statistics to be collected
sql.trace.log_statement_execute                    false          b     set to true to enable logging of executed statements
sql.trace.session_eventlog.enabled                 false          b     set to true to enable session tracing
sql.trace.txn.enable_threshold                     0s             d     duration beyond which all transactions are traced (set to 0 to disable)
trace.debug.enable                                 false          b     if set, traces for recent requests can be seen in the /debug page
trace.lightstep.token                              ·              s     if set, traces go to Lightstep using this token
trace.zipkin.collector                             ·              s     if set, traces go to the given Zipkin instance (example: '127.0.0.1:9411'); ignored if trace.lightstep.token is set.
version                                            1.1            m     set the active cluster version in the format '<major>.<minor>'.

query T colnames
SELECT * FROM [SHOW SESSION_USER]
----
session_user
root

query T colnames
SELECT * FROM [SHOW DATABASE]
----
database
test

query T colnames
SELECT * FROM [SHOW DATABASES]
----
Database
crdb_internal
information_schema
pg_catalog
system
test

query TTT colnames
SELECT * FROM [SHOW GRANTS ON system.descriptor]
----
Table       User  Privileges
descriptor  root  GRANT
descriptor  root  SELECT

query TTBITTBB colnames
SELECT * FROM [SHOW INDEX FROM system.descriptor]
----
Table       Name     Unique  Seq  Column  Direction  Storing  Implicit
descriptor  primary  true    1    id      ASC        false    false

query TTTTT colnames
SELECT * FROM [SHOW CONSTRAINT FROM system.descriptor]
----
Table       Name     Type         Column(s)  Details
descriptor  primary  PRIMARY KEY  id         NULL

query TTBITTBB colnames
SELECT * FROM [SHOW KEYS FROM system.descriptor]
----
Table       Name     Unique  Seq  Column  Direction  Storing  Implicit
descriptor  primary  true    1    id      ASC        false    false

query T colnames
SELECT * FROM [SHOW TABLES FROM system]
----
Table
descriptor
eventlog
jobs
lease
namespace
rangelog
settings
ui
users
web_sessions
zones

query ITTT colnames
SELECT node_id,username,application_name,active_queries FROM [SHOW SESSIONS] WHERE active_queries != ''
----
node_id  username  application_name  active_queries
1        root      ·                 SELECT node_id, username, application_name, active_queries FROM [SHOW CLUSTER SESSIONS] WHERE active_queries != ''

query ITT colnames
SELECT node_id, username, query FROM [SHOW QUERIES]
----
node_id   username   query
1         root       SELECT node_id, username, query FROM [SHOW CLUSTER QUERIES]


query T colnames
CREATE TABLE foo(x INT); SELECT * FROM [SHOW TABLES]
----
Table
foo


query T colnames
SELECT * FROM [SHOW TIME ZONE]
----
time zone
UTC


query T colnames
SELECT * FROM [SHOW TRANSACTION ISOLATION LEVEL]
----
transaction_isolation
serializable


query T colnames
SELECT * FROM [SHOW TRANSACTION PRIORITY]
----
transaction_priority
normal

query T colnames
SELECT * FROM [SHOW TRANSACTION STATUS]
----
transaction_status
NoTxn


query TT colnames
SELECT * FROM [SHOW CREATE TABLE system.descriptor]
----
Table              CreateTable
system.descriptor  CREATE TABLE descriptor (
  id INT NOT NULL,
  descriptor BYTES NULL,
  CONSTRAINT "primary" PRIMARY KEY (id ASC),
  FAMILY "primary" (id),
  FAMILY fam_2_descriptor (descriptor)
)


query TT colnames
CREATE VIEW v AS SELECT id FROM system.descriptor; SELECT * FROM [SHOW CREATE VIEW v]
----
View  CreateView
v     CREATE VIEW v (id) AS SELECT id FROM system.descriptor


query T colnames
SELECT * FROM [SHOW USERS]
----
username
testuser


query TTTI colnames
SELECT * FROM [SHOW TESTING_RANGES FROM TABLE system.descriptor]
----
Start Key  End Key  Replicas  Lease Holder
NULL       NULL     {1}       1

query TTTI colnames
CREATE INDEX ix ON foo(x); SELECT * FROM [SHOW TESTING_RANGES FROM INDEX foo@ix]
----
Start Key  End Key  Replicas  Lease Holder
NULL       NULL     {1}       1

query TTTTTT colnames
SELECT * FROM [SHOW TRACE FOR SESSION]
----
timestamp age message context operation span

query TTTTTT colnames
SELECT * FROM [SHOW TRACE FOR SELECT 1] LIMIT 0
----
timestamp age message context operation span

query ITTTTTTTTRTI colnames
SELECT * FROM [SHOW JOBS] LIMIT 0
----
id  type  description  username  status  created  started  finished  modified  fraction_completed  error  coordinator_id
