/
show_source
298 lines (253 loc) · 7.29 KB
/
show_source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# LogicTest: local local-opt
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
# We filter here because optimizer will be different depending on which
# configuration this logic test is running in.
query TT colnames
SELECT * FROM [SHOW ALL] WHERE variable != 'optimizer' AND variable != 'crdb_version'
----
variable value
application_name ·
bytea_output hex
client_encoding UTF8
client_min_messages notice
database test
datestyle ISO, MDY
default_transaction_isolation serializable
default_transaction_read_only off
distsql 2.0-off
experimental_force_lookup_join off
experimental_force_split_at off
experimental_force_zigzag_join off
experimental_serial_normalization rowid
experimental_vectorize off
extra_float_digits 0
force_savepoint_restart off
integer_datetimes on
intervalstyle postgres
max_index_keys 32
node_id 1
search_path public
server_encoding UTF8
server_version 9.5.0
server_version_num 90500
session_user root
sql_safe_updates off
standard_conforming_strings on
statement_timeout 0
timezone UTC
tracing off
transaction_isolation serializable
transaction_priority normal
transaction_read_only off
transaction_status NoTxn
query I colnames
SELECT * FROM [SHOW CLUSTER SETTING sql.defaults.distsql]
----
sql.defaults.distsql
3
query TTTT colnames
SELECT * FROM [SHOW ALL CLUSTER SETTINGS] WHERE variable LIKE '%organization'
----
variable value setting_type description
cluster.organization · s organization name
query T colnames
SELECT * FROM [SHOW SESSION_USER]
----
session_user
root
query T colnames
SELECT * FROM [SHOW DATABASE]
----
database
test
query TT colnames
SELECT * FROM [SHOW ZONE CONFIGURATIONS] LIMIT 0
----
zone_name config_sql
query TT colnames
SELECT * FROM [SHOW ZONE CONFIGURATION FOR TABLE system.users] LIMIT 0
----
zone_name config_sql
query T colnames
SELECT * FROM [SHOW DATABASES]
----
database_name
defaultdb
postgres
system
test
query TTTTT colnames
SELECT * FROM [SHOW GRANTS ON system.descriptor]
----
database_name schema_name table_name grantee privilege_type
system public descriptor admin GRANT
system public descriptor admin SELECT
system public descriptor root GRANT
system public descriptor root SELECT
query TTBITTBB colnames
SELECT * FROM [SHOW INDEX FROM system.descriptor]
----
table_name index_name non_unique seq_in_index column_name direction storing implicit
descriptor primary false 1 id ASC false false
query TTTTB colnames
SELECT * FROM [SHOW CONSTRAINT FROM system.descriptor]
----
table_name constraint_name constraint_type details validated
descriptor primary PRIMARY KEY PRIMARY KEY (id ASC) true
query TTBITTBB colnames
SELECT * FROM [SHOW KEYS FROM system.descriptor]
----
table_name index_name non_unique seq_in_index column_name direction storing implicit
descriptor primary false 1 id ASC false false
query T colnames
SELECT * FROM [SHOW SCHEMAS FROM system]
----
schema_name
crdb_internal
information_schema
pg_catalog
public
query T colnames
SELECT * FROM [SHOW TABLES FROM system]
----
table_name
descriptor
eventlog
jobs
lease
locations
namespace
rangelog
role_members
settings
table_statistics
ui
users
web_sessions
zones
query ITTT colnames
SELECT node_id, user_name, application_name, active_queries
FROM [SHOW SESSIONS]
WHERE active_queries != ''
----
node_id user_name application_name active_queries
1 root · SELECT node_id, user_name, application_name, active_queries FROM [SHOW CLUSTER SESSIONS] WHERE active_queries != ''
query ITT colnames
SELECT node_id, user_name, query FROM [SHOW QUERIES]
----
node_id user_name query
1 root SELECT node_id, user_name, query FROM [SHOW CLUSTER QUERIES]
query T colnames
SELECT * FROM [SHOW SCHEMAS]
----
schema_name
crdb_internal
information_schema
pg_catalog
public
query T colnames
CREATE TABLE foo(x INT); SELECT * FROM [SHOW TABLES]
----
table_name
foo
query T colnames
SELECT * FROM [SHOW TIMEZONE]
----
timezone
UTC
query T colnames
SELECT * FROM [SHOW TIME ZONE]
----
timezone
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_name create_statement
system.public.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]
----
table_name create_statement
v CREATE VIEW v (id) AS SELECT id FROM system.public.descriptor
query T colnames
SELECT * FROM [SHOW USERS]
----
user_name
root
testuser
query TTITI colnames
SELECT * FROM [SHOW EXPERIMENTAL_RANGES FROM TABLE system.descriptor]
----
start_key end_key range_id replicas lease_holder
NULL NULL 1 {1} 1
query TTITI colnames
CREATE INDEX ix ON foo(x); SELECT * FROM [SHOW EXPERIMENTAL_RANGES FROM INDEX foo@ix]
----
start_key end_key range_id replicas lease_holder
NULL NULL 1 {1} 1
query TTTTTTT colnames
SELECT * FROM [SHOW TRACE FOR SESSION] LIMIT 0
----
timestamp age message tag location operation span
query TTTT colnames
SELECT * FROM [SHOW COMPACT TRACE FOR SESSION] LIMIT 0
----
age message tag operation
query ITTTTTTTTTRTI colnames
SELECT * FROM [SHOW JOBS] LIMIT 0
----
job_id job_type description user_name status running_status created started finished modified fraction_completed error coordinator_id
query TT colnames
SELECT * FROM [SHOW SYNTAX 'select 1; select 2']
----
field text
sql SELECT 1
sql SELECT 2
# Test the SHOW SYNTAX statement. We avoid printing out the line number
# here because that is highly likely to change as code is edited.
query TT colnames
SELECT field, replace(text, e'\n', ' ') AS text FROM [SHOW SYNTAX 'foo']
WHERE field != 'line'
----
field text
error syntax error at or near "foo"
code 42601
file sql/show_syntax.go
function runShowSyntax
detail source SQL: foo ^