information_schema.slt 142 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088
  1. # Copyright 2015 - 2019 The Cockroach Authors. All rights reserved.
  2. # Copyright Materialize, Inc. and contributors. All rights reserved.
  3. #
  4. # Use of this software is governed by the Business Source License
  5. # included in the LICENSE file at the root of this repository.
  6. #
  7. # As of the Change Date specified in that file, in accordance with
  8. # the Business Source License, use of this software will be governed
  9. # by the Apache License, Version 2.0.
  10. #
  11. # This file is derived from the logic test suite in CockroachDB. The
  12. # original file was retrieved on June 10, 2019 from:
  13. #
  14. # https://github.com/cockroachdb/cockroach/blob/d2f7fbf5dd1fc1a099bbad790a2e1f7c60a66cc3/pkg/sql/logictest/testdata/logic_test/information_schema
  15. #
  16. # The original source code is subject to the terms of the Apache
  17. # 2.0 license, a copy of which can be found in the LICENSE file at the
  18. # root of this repository.
  19. # not supported yet
  20. halt
  21. mode cockroach
  22. # Verify information_schema database handles mutation statements correctly.
  23. query error database "information_schema" does not exist
  24. ALTER DATABASE information_schema RENAME TO not_information_schema
  25. statement error schema cannot be modified: "information_schema"
  26. CREATE TABLE information_schema.t (x INT)
  27. query error database "information_schema" does not exist
  28. DROP DATABASE information_schema
  29. query T
  30. SHOW TABLES FROM information_schema
  31. ----
  32. administrable_role_authorizations
  33. applicable_roles
  34. character_sets
  35. column_privileges
  36. columns
  37. constraint_column_usage
  38. enabled_roles
  39. key_column_usage
  40. parameters
  41. referential_constraints
  42. role_table_grants
  43. routines
  44. schema_privileges
  45. schemata
  46. sequences
  47. statistics
  48. table_constraints
  49. table_privileges
  50. tables
  51. user_privileges
  52. views
  53. # Verify that the name is not special for databases.
  54. statement ok
  55. CREATE DATABASE other_db
  56. statement ok
  57. ALTER DATABASE other_db RENAME TO information_schema
  58. statement error database "information_schema" already exists
  59. CREATE DATABASE information_schema
  60. statement ok
  61. DROP DATABASE information_schema CASCADE
  62. # Verify information_schema tables handle mutation statements correctly.
  63. statement error user root does not have DROP privilege on relation tables
  64. ALTER TABLE information_schema.tables RENAME TO information_schema.bad
  65. statement error user root does not have CREATE privilege on relation tables
  66. ALTER TABLE information_schema.tables RENAME COLUMN x TO y
  67. statement error user root does not have CREATE privilege on relation tables
  68. ALTER TABLE information_schema.tables ADD COLUMN x DECIMAL
  69. statement error user root does not have CREATE privilege on relation tables
  70. ALTER TABLE information_schema.tables DROP COLUMN x
  71. statement error user root does not have CREATE privilege on relation tables
  72. ALTER TABLE information_schema.tables ADD CONSTRAINT foo UNIQUE (b)
  73. statement error user root does not have CREATE privilege on relation tables
  74. ALTER TABLE information_schema.tables DROP CONSTRAINT bar
  75. statement error user root does not have CREATE privilege on relation tables
  76. ALTER TABLE information_schema.tables ALTER COLUMN x SET DEFAULT 'foo'
  77. statement error user root does not have CREATE privilege on relation tables
  78. ALTER TABLE information_schema.tables ALTER x DROP NOT NULL
  79. statement error user root does not have CREATE privilege on relation tables
  80. CREATE INDEX i on information_schema.tables (x)
  81. statement error user root does not have DROP privilege on relation tables
  82. DROP TABLE information_schema.tables
  83. statement error user root does not have CREATE privilege on relation tables
  84. DROP INDEX information_schema.tables@i
  85. statement error user root does not have GRANT privilege on relation tables
  86. GRANT CREATE ON information_schema.tables TO root
  87. statement error user root does not have GRANT privilege on relation tables
  88. REVOKE CREATE ON information_schema.tables FROM root
  89. # Verify information_schema tables handles read-only property correctly.
  90. query error user root does not have DELETE privilege on relation tables
  91. DELETE FROM information_schema.tables
  92. query error user root does not have INSERT privilege on relation tables
  93. INSERT INTO information_schema.tables VALUES ('abc')
  94. statement error user root does not have UPDATE privilege on relation tables
  95. UPDATE information_schema.tables SET a = 'abc'
  96. statement error user root does not have DROP privilege on relation tables
  97. TRUNCATE TABLE information_schema.tables
  98. # Verify information_schema handles reflection correctly.
  99. query T
  100. SHOW DATABASES
  101. ----
  102. materialize
  103. postgres
  104. system
  105. test
  106. query T
  107. SHOW TABLES FROM test.information_schema
  108. ----
  109. administrable_role_authorizations
  110. applicable_roles
  111. character_sets
  112. column_privileges
  113. columns
  114. constraint_column_usage
  115. enabled_roles
  116. key_column_usage
  117. parameters
  118. referential_constraints
  119. role_table_grants
  120. routines
  121. schema_privileges
  122. schemata
  123. sequences
  124. statistics
  125. table_constraints
  126. table_privileges
  127. tables
  128. user_privileges
  129. views
  130. query TT colnames
  131. SHOW CREATE TABLE information_schema.tables
  132. ----
  133. table_name create_statement
  134. information_schema.tables CREATE TABLE tables (
  135. table_catalog STRING NOT NULL,
  136. table_schema STRING NOT NULL,
  137. table_name STRING NOT NULL,
  138. table_type STRING NOT NULL,
  139. is_insertable_into STRING NOT NULL,
  140. version INT8 NULL
  141. )
  142. query TTBTTTB colnames
  143. SHOW COLUMNS FROM information_schema.tables
  144. ----
  145. column_name data_type is_nullable column_default generation_expression indices is_hidden
  146. table_catalog STRING false NULL · {} false
  147. table_schema STRING false NULL · {} false
  148. table_name STRING false NULL · {} false
  149. table_type STRING false NULL · {} false
  150. is_insertable_into STRING false NULL · {} false
  151. version INT8 true NULL · {} false
  152. query TTBITTBB colnames
  153. SHOW INDEXES ON information_schema.tables
  154. ----
  155. table_name index_name non_unique seq_in_index column_name direction storing implicit
  156. query TTTTB colnames
  157. SHOW CONSTRAINTS FROM information_schema.tables
  158. ----
  159. table_name constraint_name constraint_type details validated
  160. query TTTTT colnames
  161. SHOW GRANTS ON information_schema.tables
  162. ----
  163. database_name schema_name table_name grantee privilege_type
  164. test information_schema tables public SELECT
  165. # Verify selecting from information_schema.
  166. ## information_schema.schemata
  167. query TTTT colnames
  168. SELECT * FROM information_schema.schemata
  169. ----
  170. catalog_name schema_name default_character_set_name sql_path
  171. test crdb_internal NULL NULL
  172. test information_schema NULL NULL
  173. test pg_catalog NULL NULL
  174. test public NULL NULL
  175. query TTTT colnames
  176. SELECT * FROM INFormaTION_SCHEMa.schemata
  177. ----
  178. catalog_name schema_name default_character_set_name sql_path
  179. test crdb_internal NULL NULL
  180. test information_schema NULL NULL
  181. test pg_catalog NULL NULL
  182. test public NULL NULL
  183. ## information_schema.tables
  184. # Check the default contents of information_schema.tables (incl. the
  185. # special system tables)
  186. query TT rowsort
  187. select table_schema, table_name FROM information_schema.tables
  188. ----
  189. crdb_internal backward_dependencies
  190. crdb_internal builtin_functions
  191. crdb_internal cluster_queries
  192. crdb_internal cluster_sessions
  193. crdb_internal cluster_settings
  194. crdb_internal create_statements
  195. crdb_internal feature_usage
  196. crdb_internal forward_dependencies
  197. crdb_internal gossip_alerts
  198. crdb_internal gossip_liveness
  199. crdb_internal gossip_network
  200. crdb_internal gossip_nodes
  201. crdb_internal index_columns
  202. crdb_internal jobs
  203. crdb_internal kv_node_status
  204. crdb_internal kv_store_status
  205. crdb_internal leases
  206. crdb_internal node_build_info
  207. crdb_internal node_metrics
  208. crdb_internal node_queries
  209. crdb_internal node_runtime_info
  210. crdb_internal node_sessions
  211. crdb_internal node_statement_statistics
  212. crdb_internal partitions
  213. crdb_internal predefined_comments
  214. crdb_internal ranges
  215. crdb_internal ranges_no_leases
  216. crdb_internal schema_changes
  217. crdb_internal session_trace
  218. crdb_internal session_variables
  219. crdb_internal table_columns
  220. crdb_internal table_indexes
  221. crdb_internal tables
  222. crdb_internal zones
  223. information_schema administrable_role_authorizations
  224. information_schema applicable_roles
  225. information_schema column_privileges
  226. information_schema columns
  227. information_schema constraint_column_usage
  228. information_schema enabled_roles
  229. information_schema key_column_usage
  230. information_schema parameters
  231. information_schema referential_constraints
  232. information_schema role_table_grants
  233. information_schema routines
  234. information_schema schema_privileges
  235. information_schema schemata
  236. information_schema sequences
  237. information_schema statistics
  238. information_schema table_constraints
  239. information_schema table_privileges
  240. information_schema tables
  241. information_schema user_privileges
  242. information_schema views
  243. pg_catalog pg_am
  244. pg_catalog pg_attrdef
  245. pg_catalog pg_attribute
  246. pg_catalog pg_auth_members
  247. pg_catalog pg_class
  248. pg_catalog pg_collation
  249. pg_catalog pg_constraint
  250. pg_catalog pg_database
  251. pg_catalog pg_depend
  252. pg_catalog pg_description
  253. pg_catalog pg_enum
  254. pg_catalog pg_extension
  255. pg_catalog pg_foreign_data_wrapper
  256. pg_catalog pg_foreign_server
  257. pg_catalog pg_foreign_table
  258. pg_catalog pg_index
  259. pg_catalog pg_indexes
  260. pg_catalog pg_inherits
  261. pg_catalog pg_language
  262. pg_catalog pg_namespace
  263. pg_catalog pg_operator
  264. pg_catalog pg_proc
  265. pg_catalog pg_range
  266. pg_catalog pg_rewrite
  267. pg_catalog pg_roles
  268. pg_catalog pg_seclabel
  269. pg_catalog pg_sequence
  270. pg_catalog pg_settings
  271. pg_catalog pg_shdescription
  272. pg_catalog pg_shseclabel
  273. pg_catalog pg_stat_activity
  274. pg_catalog pg_tables
  275. pg_catalog pg_tablespace
  276. pg_catalog pg_trigger
  277. pg_catalog pg_type
  278. pg_catalog pg_user
  279. pg_catalog pg_user_mapping
  280. pg_catalog pg_views
  281. statement ok
  282. CREATE DATABASE other_db
  283. statement ok
  284. CREATE TABLE other_db.xyz (i INT)
  285. statement ok
  286. CREATE SEQUENCE other_db.seq
  287. statement ok
  288. CREATE VIEW other_db.abc AS SELECT i from other_db.xyz
  289. statement ok
  290. GRANT UPDATE ON other_db.xyz TO testuser
  291. user testuser
  292. # Check the output with the current database set to 'test' (the
  293. # defaults in tests). This will make the tables in other_db invisible to
  294. # a non-root user.
  295. query T
  296. SELECT table_name FROM information_schema.tables WHERE table_catalog = 'other_db'
  297. ----
  298. # Check that the other_db tables become visible when a prefix is specified
  299. query T
  300. SELECT table_name FROM other_db.information_schema.tables WHERE table_catalog = 'other_db' AND table_schema = 'public'
  301. ----
  302. xyz
  303. # Check that one can see all tables with the empty prefix.
  304. query T rowsort
  305. SELECT table_name FROM "".information_schema.tables WHERE table_catalog = 'other_db'
  306. ----
  307. backward_dependencies
  308. builtin_functions
  309. cluster_queries
  310. cluster_sessions
  311. cluster_settings
  312. create_statements
  313. feature_usage
  314. forward_dependencies
  315. gossip_alerts
  316. gossip_liveness
  317. gossip_network
  318. gossip_nodes
  319. index_columns
  320. jobs
  321. kv_node_status
  322. kv_store_status
  323. leases
  324. node_build_info
  325. node_metrics
  326. node_queries
  327. node_runtime_info
  328. node_sessions
  329. node_statement_statistics
  330. partitions
  331. predefined_comments
  332. ranges
  333. ranges_no_leases
  334. schema_changes
  335. session_trace
  336. session_variables
  337. table_columns
  338. table_indexes
  339. tables
  340. zones
  341. administrable_role_authorizations
  342. applicable_roles
  343. column_privileges
  344. columns
  345. constraint_column_usage
  346. enabled_roles
  347. key_column_usage
  348. parameters
  349. referential_constraints
  350. role_table_grants
  351. routines
  352. schema_privileges
  353. schemata
  354. sequences
  355. statistics
  356. table_constraints
  357. table_privileges
  358. tables
  359. user_privileges
  360. views
  361. pg_am
  362. pg_attrdef
  363. pg_attribute
  364. pg_auth_members
  365. pg_class
  366. pg_collation
  367. pg_constraint
  368. pg_database
  369. pg_depend
  370. pg_description
  371. pg_enum
  372. pg_extension
  373. pg_foreign_data_wrapper
  374. pg_foreign_server
  375. pg_foreign_table
  376. pg_index
  377. pg_indexes
  378. pg_inherits
  379. pg_language
  380. pg_namespace
  381. pg_operator
  382. pg_proc
  383. pg_range
  384. pg_rewrite
  385. pg_roles
  386. pg_seclabel
  387. pg_sequence
  388. pg_settings
  389. pg_shdescription
  390. pg_shseclabel
  391. pg_stat_activity
  392. pg_tables
  393. pg_tablespace
  394. pg_trigger
  395. pg_type
  396. pg_user
  397. pg_user_mapping
  398. pg_views
  399. xyz
  400. # Check that the other_db tables become visible to non-root when the current database is changed.
  401. query T
  402. SET DATABASE = other_db; SELECT table_name FROM information_schema.tables WHERE table_catalog = 'other_db' AND table_schema = 'public'
  403. ----
  404. xyz
  405. user root
  406. # Check that root sees everything when there is no current database
  407. query T
  408. SET DATABASE = ''; SELECT table_name FROM information_schema.tables WHERE table_catalog = 'other_db' AND table_schema = 'public'
  409. ----
  410. xyz
  411. abc
  412. # Check that root doesn't see other things when there is a current database
  413. query T
  414. SET DATABASE = test; SELECT table_name FROM information_schema.tables WHERE table_schema = 'other_db'
  415. ----
  416. # Check that filtering works.
  417. query T
  418. SELECT table_name FROM other_db.information_schema.tables WHERE table_name > 't' ORDER BY 1 DESC
  419. ----
  420. zones
  421. xyz
  422. views
  423. user_privileges
  424. tables
  425. tables
  426. table_privileges
  427. table_indexes
  428. table_constraints
  429. table_columns
  430. # Check that the metadata is reported properly.
  431. query TTTTTI colnames
  432. SELECT * FROM system.information_schema.tables
  433. ----
  434. table_catalog table_schema table_name table_type is_insertable_into version
  435. system crdb_internal backward_dependencies SYSTEM VIEW NO 1
  436. system crdb_internal builtin_functions SYSTEM VIEW NO 1
  437. system crdb_internal cluster_queries SYSTEM VIEW NO 1
  438. system crdb_internal cluster_sessions SYSTEM VIEW NO 1
  439. system crdb_internal cluster_settings SYSTEM VIEW NO 1
  440. system crdb_internal create_statements SYSTEM VIEW NO 1
  441. system crdb_internal feature_usage SYSTEM VIEW NO 1
  442. system crdb_internal forward_dependencies SYSTEM VIEW NO 1
  443. system crdb_internal gossip_alerts SYSTEM VIEW NO 1
  444. system crdb_internal gossip_liveness SYSTEM VIEW NO 1
  445. system crdb_internal gossip_network SYSTEM VIEW NO 1
  446. system crdb_internal gossip_nodes SYSTEM VIEW NO 1
  447. system crdb_internal index_columns SYSTEM VIEW NO 1
  448. system crdb_internal jobs SYSTEM VIEW NO 1
  449. system crdb_internal kv_node_status SYSTEM VIEW NO 1
  450. system crdb_internal kv_store_status SYSTEM VIEW NO 1
  451. system crdb_internal leases SYSTEM VIEW NO 1
  452. system crdb_internal node_build_info SYSTEM VIEW NO 1
  453. system crdb_internal node_metrics SYSTEM VIEW NO 1
  454. system crdb_internal node_queries SYSTEM VIEW NO 1
  455. system crdb_internal node_runtime_info SYSTEM VIEW NO 1
  456. system crdb_internal node_sessions SYSTEM VIEW NO 1
  457. system crdb_internal node_statement_statistics SYSTEM VIEW NO 1
  458. system crdb_internal partitions SYSTEM VIEW NO 1
  459. system crdb_internal predefined_comments SYSTEM VIEW NO 1
  460. system crdb_internal ranges SYSTEM VIEW NO 1
  461. system crdb_internal ranges_no_leases SYSTEM VIEW NO 1
  462. system crdb_internal schema_changes SYSTEM VIEW NO 1
  463. system crdb_internal session_trace SYSTEM VIEW NO 1
  464. system crdb_internal session_variables SYSTEM VIEW NO 1
  465. system crdb_internal table_columns SYSTEM VIEW NO 1
  466. system crdb_internal table_indexes SYSTEM VIEW NO 1
  467. system crdb_internal tables SYSTEM VIEW NO 1
  468. system crdb_internal zones SYSTEM VIEW NO 1
  469. system information_schema administrable_role_authorizations SYSTEM VIEW NO 1
  470. system information_schema applicable_roles SYSTEM VIEW NO 1
  471. system information_schema column_privileges SYSTEM VIEW NO 1
  472. system information_schema columns SYSTEM VIEW NO 1
  473. system information_schema constraint_column_usage SYSTEM VIEW NO 1
  474. system information_schema enabled_roles SYSTEM VIEW NO 1
  475. system information_schema key_column_usage SYSTEM VIEW NO 1
  476. system information_schema parameters SYSTEM VIEW NO 1
  477. system information_schema referential_constraints SYSTEM VIEW NO 1
  478. system information_schema role_table_grants SYSTEM VIEW NO 1
  479. system information_schema routines SYSTEM VIEW NO 1
  480. system information_schema schema_privileges SYSTEM VIEW NO 1
  481. system information_schema schemata SYSTEM VIEW NO 1
  482. system information_schema sequences SYSTEM VIEW NO 1
  483. system information_schema statistics SYSTEM VIEW NO 1
  484. system information_schema table_constraints SYSTEM VIEW NO 1
  485. system information_schema table_privileges SYSTEM VIEW NO 1
  486. system information_schema tables SYSTEM VIEW NO 1
  487. system information_schema user_privileges SYSTEM VIEW NO 1
  488. system information_schema views SYSTEM VIEW NO 1
  489. system pg_catalog pg_am SYSTEM VIEW NO 1
  490. system pg_catalog pg_attrdef SYSTEM VIEW NO 1
  491. system pg_catalog pg_attribute SYSTEM VIEW NO 1
  492. system pg_catalog pg_auth_members SYSTEM VIEW NO 1
  493. system pg_catalog pg_class SYSTEM VIEW NO 1
  494. system pg_catalog pg_collation SYSTEM VIEW NO 1
  495. system pg_catalog pg_constraint SYSTEM VIEW NO 1
  496. system pg_catalog pg_database SYSTEM VIEW NO 1
  497. system pg_catalog pg_depend SYSTEM VIEW NO 1
  498. system pg_catalog pg_description SYSTEM VIEW NO 1
  499. system pg_catalog pg_enum SYSTEM VIEW NO 1
  500. system pg_catalog pg_extension SYSTEM VIEW NO 1
  501. system pg_catalog pg_foreign_data_wrapper SYSTEM VIEW NO 1
  502. system pg_catalog pg_foreign_server SYSTEM VIEW NO 1
  503. system pg_catalog pg_foreign_table SYSTEM VIEW NO 1
  504. system pg_catalog pg_index SYSTEM VIEW NO 1
  505. system pg_catalog pg_indexes SYSTEM VIEW NO 1
  506. system pg_catalog pg_inherits SYSTEM VIEW NO 1
  507. system pg_catalog pg_language SYSTEM VIEW NO 1
  508. system pg_catalog pg_namespace SYSTEM VIEW NO 1
  509. system pg_catalog pg_operator SYSTEM VIEW NO 1
  510. system pg_catalog pg_proc SYSTEM VIEW NO 1
  511. system pg_catalog pg_range SYSTEM VIEW NO 1
  512. system pg_catalog pg_rewrite SYSTEM VIEW NO 1
  513. system pg_catalog pg_roles SYSTEM VIEW NO 1
  514. system pg_catalog pg_seclabel SYSTEM VIEW NO 1
  515. system pg_catalog pg_sequence SYSTEM VIEW NO 1
  516. system pg_catalog pg_settings SYSTEM VIEW NO 1
  517. system pg_catalog pg_shdescription SYSTEM VIEW NO 1
  518. system pg_catalog pg_shseclabel SYSTEM VIEW NO 1
  519. system pg_catalog pg_stat_activity SYSTEM VIEW NO 1
  520. system pg_catalog pg_tables SYSTEM VIEW NO 1
  521. system pg_catalog pg_tablespace SYSTEM VIEW NO 1
  522. system pg_catalog pg_trigger SYSTEM VIEW NO 1
  523. system pg_catalog pg_type SYSTEM VIEW NO 1
  524. system pg_catalog pg_user SYSTEM VIEW NO 1
  525. system pg_catalog pg_user_mapping SYSTEM VIEW NO 1
  526. system pg_catalog pg_views SYSTEM VIEW NO 1
  527. system public namespace BASE TABLE YES 1
  528. system public descriptor BASE TABLE YES 1
  529. system public users BASE TABLE YES 1
  530. system public zones BASE TABLE YES 1
  531. system public settings BASE TABLE YES 1
  532. system public lease BASE TABLE YES 1
  533. system public eventlog BASE TABLE YES 1
  534. system public rangelog BASE TABLE YES 1
  535. system public ui BASE TABLE YES 1
  536. system public jobs BASE TABLE YES 1
  537. system public web_sessions BASE TABLE YES 1
  538. system public table_statistics BASE TABLE YES 1
  539. system public locations BASE TABLE YES 1
  540. system public role_members BASE TABLE YES 1
  541. system public comments BASE TABLE YES 1
  542. statement ok
  543. ALTER TABLE other_db.xyz ADD COLUMN j INT
  544. query TTI colnames
  545. SELECT TABLE_CATALOG, TABLE_NAME, VERSION FROM "".information_schema.tables WHERE version > 1 AND TABLE_SCHEMA = 'public' ORDER BY 1,2
  546. ----
  547. table_catalog table_name version
  548. other_db xyz 6
  549. user testuser
  550. # Check that another user cannot see other_db.adbc any more because they
  551. # don't have privileges on it.
  552. query TTTTTI colnames
  553. SELECT * FROM other_db.information_schema.tables WHERE table_catalog = 'other_db' AND table_schema = 'public'
  554. ----
  555. table_catalog table_schema table_name table_type is_insertable_into version
  556. other_db public xyz BASE TABLE YES 6
  557. user root
  558. statement ok
  559. GRANT SELECT ON other_db.abc TO testuser
  560. user testuser
  561. # Check the user can see the tables now that they have privilege.
  562. query TTTTTI colnames
  563. SELECT * FROM other_db.information_schema.tables WHERE table_catalog = 'other_db' AND table_schema = 'public' ORDER BY 1, 3
  564. ----
  565. table_catalog table_schema table_name table_type is_insertable_into version
  566. other_db public abc VIEW NO 2
  567. other_db public xyz BASE TABLE YES 6
  568. user root
  569. statement ok
  570. DROP DATABASE other_db CASCADE
  571. statement ok
  572. SET DATABASE = test
  573. ## information_schema.table_constraints
  574. ## information_schema.constraint_column_usage
  575. query TTTTTTTTT colnames
  576. SELECT *
  577. FROM system.information_schema.table_constraints
  578. ORDER BY TABLE_NAME, CONSTRAINT_TYPE, CONSTRAINT_NAME
  579. ----
  580. constraint_catalog constraint_schema constraint_name table_catalog table_schema table_name constraint_type is_deferrable initially_deferred
  581. system public primary system public comments PRIMARY KEY NO NO
  582. system public primary system public descriptor PRIMARY KEY NO NO
  583. system public primary system public eventlog PRIMARY KEY NO NO
  584. system public primary system public jobs PRIMARY KEY NO NO
  585. system public primary system public lease PRIMARY KEY NO NO
  586. system public primary system public locations PRIMARY KEY NO NO
  587. system public primary system public namespace PRIMARY KEY NO NO
  588. system public primary system public rangelog PRIMARY KEY NO NO
  589. system public primary system public role_members PRIMARY KEY NO NO
  590. system public primary system public settings PRIMARY KEY NO NO
  591. system public primary system public table_statistics PRIMARY KEY NO NO
  592. system public primary system public ui PRIMARY KEY NO NO
  593. system public primary system public users PRIMARY KEY NO NO
  594. system public primary system public web_sessions PRIMARY KEY NO NO
  595. system public primary system public zones PRIMARY KEY NO NO
  596. query TTTTTTT colnames
  597. SELECT *
  598. FROM system.information_schema.constraint_column_usage
  599. ORDER BY TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME
  600. ----
  601. table_catalog table_schema table_name column_name constraint_catalog constraint_schema constraint_name
  602. system public comments object_id system public primary
  603. system public comments sub_id system public primary
  604. system public comments type system public primary
  605. system public descriptor id system public primary
  606. system public eventlog timestamp system public primary
  607. system public eventlog uniqueID system public primary
  608. system public jobs id system public primary
  609. system public lease descID system public primary
  610. system public lease expiration system public primary
  611. system public lease nodeID system public primary
  612. system public lease version system public primary
  613. system public locations localityKey system public primary
  614. system public locations localityValue system public primary
  615. system public namespace name system public primary
  616. system public namespace parentID system public primary
  617. system public rangelog timestamp system public primary
  618. system public rangelog uniqueID system public primary
  619. system public role_members member system public primary
  620. system public role_members role system public primary
  621. system public settings name system public primary
  622. system public table_statistics statisticID system public primary
  623. system public table_statistics tableID system public primary
  624. system public ui key system public primary
  625. system public users username system public primary
  626. system public web_sessions id system public primary
  627. system public zones id system public primary
  628. statement ok
  629. CREATE DATABASE constraint_db
  630. statement ok
  631. CREATE TABLE constraint_db.t1 (
  632. p FLOAT PRIMARY KEY,
  633. a INT UNIQUE CHECK (a > 4),
  634. CONSTRAINT c2 CHECK (a < 99)
  635. )
  636. statement ok
  637. CREATE TABLE constraint_db.t2 (
  638. t1_ID INT,
  639. CONSTRAINT fk FOREIGN KEY (t1_ID) REFERENCES constraint_db.t1(a),
  640. INDEX (t1_ID)
  641. )
  642. statement ok
  643. SET DATABASE = constraint_db
  644. query TTTTTTTTT colnames
  645. SELECT *
  646. FROM information_schema.table_constraints
  647. ORDER BY TABLE_NAME, CONSTRAINT_TYPE, CONSTRAINT_NAME
  648. ----
  649. constraint_catalog constraint_schema constraint_name table_catalog table_schema table_name constraint_type is_deferrable initially_deferred
  650. constraint_db public c2 constraint_db public t1 CHECK NO NO
  651. constraint_db public check_a constraint_db public t1 CHECK NO NO
  652. constraint_db public primary constraint_db public t1 PRIMARY KEY NO NO
  653. constraint_db public t1_a_key constraint_db public t1 UNIQUE NO NO
  654. constraint_db public fk constraint_db public t2 FOREIGN KEY NO NO
  655. query TTTTTTT colnames
  656. SELECT *
  657. FROM information_schema.constraint_column_usage
  658. WHERE constraint_catalog = 'constraint_db'
  659. ORDER BY TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME
  660. ----
  661. table_catalog table_schema table_name column_name constraint_catalog constraint_schema constraint_name
  662. constraint_db public t1 a constraint_db public c2
  663. constraint_db public t1 a constraint_db public check_a
  664. constraint_db public t1 a constraint_db public fk
  665. constraint_db public t1 a constraint_db public t1_a_key
  666. constraint_db public t1 p constraint_db public primary
  667. statement ok
  668. DROP DATABASE constraint_db CASCADE
  669. ## information_schema.columns
  670. query TTTTI colnames
  671. SELECT table_catalog, table_schema, table_name, column_name, ordinal_position
  672. FROM system.information_schema.columns
  673. WHERE table_schema != 'information_schema' AND table_schema != 'pg_catalog' AND table_schema != 'crdb_internal'
  674. ORDER BY 3,4
  675. ----
  676. table_catalog table_schema table_name column_name ordinal_position
  677. system public comments comment 4
  678. system public comments object_id 2
  679. system public comments sub_id 3
  680. system public comments type 1
  681. system public descriptor descriptor 2
  682. system public descriptor id 1
  683. system public eventlog eventType 2
  684. system public eventlog info 5
  685. system public eventlog reportingID 4
  686. system public eventlog targetID 3
  687. system public eventlog timestamp 1
  688. system public eventlog uniqueID 6
  689. system public jobs created 3
  690. system public jobs id 1
  691. system public jobs payload 4
  692. system public jobs progress 5
  693. system public jobs status 2
  694. system public lease descID 1
  695. system public lease expiration 4
  696. system public lease nodeID 3
  697. system public lease version 2
  698. system public locations latitude 3
  699. system public locations localityKey 1
  700. system public locations localityValue 2
  701. system public locations longitude 4
  702. system public namespace id 3
  703. system public namespace name 2
  704. system public namespace parentID 1
  705. system public rangelog eventType 4
  706. system public rangelog info 6
  707. system public rangelog otherRangeID 5
  708. system public rangelog rangeID 2
  709. system public rangelog storeID 3
  710. system public rangelog timestamp 1
  711. system public rangelog uniqueID 7
  712. system public role_members isAdmin 3
  713. system public role_members member 2
  714. system public role_members role 1
  715. system public settings lastUpdated 3
  716. system public settings name 1
  717. system public settings value 2
  718. system public settings valueType 4
  719. system public table_statistics columnIDs 4
  720. system public table_statistics createdAt 5
  721. system public table_statistics distinctCount 7
  722. system public table_statistics histogram 9
  723. system public table_statistics name 3
  724. system public table_statistics nullCount 8
  725. system public table_statistics rowCount 6
  726. system public table_statistics statisticID 2
  727. system public table_statistics tableID 1
  728. system public ui key 1
  729. system public ui lastUpdated 3
  730. system public ui value 2
  731. system public users hashedPassword 2
  732. system public users isRole 3
  733. system public users username 1
  734. system public web_sessions auditInfo 8
  735. system public web_sessions createdAt 4
  736. system public web_sessions expiresAt 5
  737. system public web_sessions hashedSecret 2
  738. system public web_sessions id 1
  739. system public web_sessions lastUsedAt 7
  740. system public web_sessions revokedAt 6
  741. system public web_sessions username 3
  742. system public zones config 2
  743. system public zones id 1
  744. statement ok
  745. SET DATABASE = test
  746. statement ok
  747. CREATE TABLE with_defaults (a INT DEFAULT 9, b STRING DEFAULT 'default', c INT, d STRING)
  748. query TTT colnames
  749. SELECT table_name, column_name, column_default
  750. FROM information_schema.columns
  751. WHERE table_schema = 'public' AND table_name = 'with_defaults'
  752. ----
  753. table_name column_name column_default
  754. with_defaults a 9:::INT8
  755. with_defaults b 'default':::STRING
  756. with_defaults c NULL
  757. with_defaults d NULL
  758. with_defaults rowid unique_rowid()
  759. statement ok
  760. DROP TABLE with_defaults
  761. statement ok
  762. CREATE TABLE nullability (a INT NOT NULL, b STRING NOT NULL, c INT, d STRING)
  763. query TTT colnames
  764. SELECT table_name, column_name, is_nullable
  765. FROM information_schema.columns
  766. WHERE table_schema = 'public' AND table_name = 'nullability'
  767. ----
  768. table_name column_name is_nullable
  769. nullability a NO
  770. nullability b NO
  771. nullability c YES
  772. nullability d YES
  773. nullability rowid NO
  774. statement ok
  775. DROP TABLE nullability
  776. statement ok
  777. CREATE TABLE data_types (
  778. a INT,
  779. a2 INT2,
  780. a4 INT4,
  781. a8 INT8,
  782. b FLOAT,
  783. b4 FLOAT4,
  784. br REAL,
  785. c DECIMAL,
  786. cp DECIMAL(3),
  787. cps DECIMAL(3,2),
  788. d STRING,
  789. dl STRING COLLATE en,
  790. dc CHAR,
  791. dc2 CHAR(2),
  792. dv VARCHAR,
  793. dv2 VARCHAR(2),
  794. dq "char",
  795. e BYTES,
  796. f TIMESTAMP,
  797. f6 TIMESTAMP(6),
  798. g TIMESTAMPTZ,
  799. g6 TIMESTAMPTZ(6),
  800. h BIT,
  801. h2 BIT(2),
  802. hv VARBIT,
  803. hv2 VARBIT(2),
  804. i INTERVAL,
  805. j BOOL,
  806. k OID,
  807. k2 REGCLASS,
  808. k3 REGNAMESPACE,
  809. k4 REGPROC,
  810. k5 REGPROCEDURE,
  811. k6 REGTYPE,
  812. l UUID,
  813. m INT2[],
  814. m2 STRING[],
  815. m3 DECIMAL(3, 2)[],
  816. m4 VARCHAR(2)[] COLLATE en,
  817. n INET,
  818. o TIME,
  819. o6 TIME(6),
  820. p JSONB,
  821. q NAME
  822. )
  823. query TTTTTTTTTT colnames
  824. SELECT table_name, column_name, data_type, crdb_sql_type, udt_catalog, udt_schema, udt_name, collation_catalog, collation_schema, collation_name
  825. FROM information_schema.columns
  826. WHERE table_schema = 'public' AND table_name = 'data_types'
  827. ----
  828. table_name column_name data_type crdb_sql_type udt_catalog udt_schema udt_name collation_catalog collation_schema collation_name
  829. data_types a bigint INT8 test pg_catalog int8 NULL NULL NULL
  830. data_types a2 smallint INT2 test pg_catalog int2 NULL NULL NULL
  831. data_types a4 integer INT4 test pg_catalog int4 NULL NULL NULL
  832. data_types a8 bigint INT8 test pg_catalog int8 NULL NULL NULL
  833. data_types b double precision FLOAT8 test pg_catalog float8 NULL NULL NULL
  834. data_types b4 real FLOAT4 test pg_catalog float4 NULL NULL NULL
  835. data_types br real FLOAT4 test pg_catalog float4 NULL NULL NULL
  836. data_types c numeric DECIMAL test pg_catalog numeric NULL NULL NULL
  837. data_types cp numeric DECIMAL(3) test pg_catalog numeric NULL NULL NULL
  838. data_types cps numeric DECIMAL(3,2) test pg_catalog numeric NULL NULL NULL
  839. data_types d text STRING test pg_catalog text NULL NULL NULL
  840. data_types dl text STRING COLLATE en test pg_catalog text test pg_catalog en
  841. data_types dc character CHAR test pg_catalog bpchar NULL NULL NULL
  842. data_types dc2 character CHAR(2) test pg_catalog bpchar NULL NULL NULL
  843. data_types dv character varying VARCHAR test pg_catalog varchar NULL NULL NULL
  844. data_types dv2 character varying VARCHAR(2) test pg_catalog varchar NULL NULL NULL
  845. data_types dq "char" "char" test pg_catalog char NULL NULL NULL
  846. data_types e bytea BYTES test pg_catalog bytea NULL NULL NULL
  847. data_types f timestamp without time zone TIMESTAMP test pg_catalog timestamp NULL NULL NULL
  848. data_types f6 timestamp without time zone TIMESTAMP(6) test pg_catalog timestamp NULL NULL NULL
  849. data_types g timestamp with time zone TIMESTAMPTZ test pg_catalog timestamptz NULL NULL NULL
  850. data_types g6 timestamp with time zone TIMESTAMPTZ(6) test pg_catalog timestamptz NULL NULL NULL
  851. data_types h bit BIT test pg_catalog bit NULL NULL NULL
  852. data_types h2 bit BIT(2) test pg_catalog bit NULL NULL NULL
  853. data_types hv bit varying VARBIT test pg_catalog varbit NULL NULL NULL
  854. data_types hv2 bit varying VARBIT(2) test pg_catalog varbit NULL NULL NULL
  855. data_types i interval INTERVAL test pg_catalog interval NULL NULL NULL
  856. data_types j boolean BOOL test pg_catalog bool NULL NULL NULL
  857. data_types k oid OID test pg_catalog oid NULL NULL NULL
  858. data_types k2 regclass REGCLASS test pg_catalog regclass NULL NULL NULL
  859. data_types k3 regnamespace REGNAMESPACE test pg_catalog regnamespace NULL NULL NULL
  860. data_types k4 regproc REGPROC test pg_catalog regproc NULL NULL NULL
  861. data_types k5 regprocedure REGPROCEDURE test pg_catalog regprocedure NULL NULL NULL
  862. data_types k6 regtype REGTYPE test pg_catalog regtype NULL NULL NULL
  863. data_types l uuid UUID test pg_catalog uuid NULL NULL NULL
  864. data_types m ARRAY INT2[] test pg_catalog _int2 NULL NULL NULL
  865. data_types m2 ARRAY STRING[] test pg_catalog _text NULL NULL NULL
  866. data_types m3 ARRAY DECIMAL(3,2)[] test pg_catalog _numeric NULL NULL NULL
  867. data_types m4 ARRAY VARCHAR(2)[] COLLATE en test pg_catalog _varchar NULL NULL NULL
  868. data_types n inet INET test pg_catalog inet NULL NULL NULL
  869. data_types o time without time zone TIME test pg_catalog time NULL NULL NULL
  870. data_types o6 time without time zone TIME(6) test pg_catalog time NULL NULL NULL
  871. data_types p jsonb JSONB test pg_catalog jsonb NULL NULL NULL
  872. data_types q name NAME test pg_catalog name NULL NULL NULL
  873. data_types rowid bigint INT8 test pg_catalog int8 NULL NULL NULL
  874. statement ok
  875. DROP TABLE data_types
  876. statement ok
  877. CREATE TABLE computed (a INT, b INT AS (a + 1) STORED)
  878. query TTTT colnames
  879. SELECT column_name, is_generated, generation_expression, is_updatable
  880. FROM information_schema.columns
  881. WHERE table_schema = 'public' AND table_name = 'computed'
  882. ----
  883. column_name is_generated generation_expression is_updatable
  884. a NO · YES
  885. b YES a + 1 NO
  886. rowid NO · YES
  887. statement ok
  888. CREATE TABLE char_len (
  889. a INT, b INT2, c INT4,
  890. d STRING, e STRING(12),
  891. dc CHAR, ec CHAR(12),
  892. dv VARCHAR, ev VARCHAR(12),
  893. dq "char",
  894. f FLOAT,
  895. g BIT, h BIT(12),
  896. i VARBIT, j VARBIT(12))
  897. query TTII colnames
  898. SELECT table_name, column_name, character_maximum_length, character_octet_length
  899. FROM information_schema.columns
  900. WHERE table_schema = 'public' AND table_name = 'char_len'
  901. ----
  902. table_name column_name character_maximum_length character_octet_length
  903. char_len a NULL NULL
  904. char_len b NULL NULL
  905. char_len c NULL NULL
  906. char_len d NULL NULL
  907. char_len e 12 48
  908. char_len dc 1 4
  909. char_len ec 12 48
  910. char_len dv NULL NULL
  911. char_len ev 12 48
  912. char_len dq NULL NULL
  913. char_len f NULL NULL
  914. char_len g 1 NULL
  915. char_len h 12 NULL
  916. char_len i NULL NULL
  917. char_len j 12 NULL
  918. char_len rowid NULL NULL
  919. statement ok
  920. DROP TABLE char_len
  921. statement ok
  922. CREATE TABLE num_prec (a INT, b FLOAT, c FLOAT(23), d DECIMAL, e DECIMAL(12), f DECIMAL(12, 6), g BOOLEAN)
  923. query TTIIII colnames
  924. SELECT table_name, column_name, numeric_precision, numeric_precision_radix, numeric_scale, datetime_precision
  925. FROM information_schema.columns
  926. WHERE table_schema = 'public' AND table_name = 'num_prec'
  927. ----
  928. table_name column_name numeric_precision numeric_precision_radix numeric_scale datetime_precision
  929. num_prec a 64 2 0 NULL
  930. num_prec b 53 2 NULL NULL
  931. num_prec c 24 2 NULL NULL
  932. num_prec d NULL 10 NULL NULL
  933. num_prec e 12 10 0 NULL
  934. num_prec f 12 10 6 NULL
  935. num_prec g NULL NULL NULL NULL
  936. num_prec rowid 64 2 0 NULL
  937. statement ok
  938. DROP TABLE num_prec
  939. ## information_schema.key_column_usage
  940. ## information_schema.referential_constraints
  941. statement ok
  942. CREATE DATABASE constraint_column
  943. statement ok
  944. CREATE TABLE constraint_column.t1 (
  945. p FLOAT PRIMARY KEY,
  946. a INT UNIQUE,
  947. b INT,
  948. c INT CHECK(c > 0),
  949. UNIQUE INDEX index_key(b, c)
  950. )
  951. statement ok
  952. CREATE TABLE constraint_column.t2 (
  953. t1_ID INT PRIMARY KEY,
  954. CONSTRAINT fk FOREIGN KEY (t1_ID) REFERENCES constraint_column.t1(a) ON DELETE RESTRICT
  955. )
  956. statement ok
  957. CREATE TABLE constraint_column.t3 (
  958. a INT,
  959. b INT,
  960. CONSTRAINT fk2 FOREIGN KEY (a, b) REFERENCES constraint_column.t1(b, c) ON UPDATE CASCADE,
  961. INDEX (a, b)
  962. )
  963. statement ok
  964. SET DATABASE = constraint_column
  965. query TTTTTTTII colnames
  966. SELECT * FROM information_schema.key_column_usage WHERE constraint_schema = 'public' ORDER BY TABLE_NAME, CONSTRAINT_NAME, ORDINAL_POSITION
  967. ----
  968. constraint_catalog constraint_schema constraint_name table_catalog table_schema table_name column_name ordinal_position position_in_unique_constraint
  969. constraint_column public index_key constraint_column public t1 b 1 NULL
  970. constraint_column public index_key constraint_column public t1 c 2 NULL
  971. constraint_column public primary constraint_column public t1 p 1 NULL
  972. constraint_column public t1_a_key constraint_column public t1 a 1 NULL
  973. constraint_column public fk constraint_column public t2 t1_id 1 1
  974. constraint_column public primary constraint_column public t2 t1_id 1 NULL
  975. constraint_column public fk2 constraint_column public t3 a 1 1
  976. constraint_column public fk2 constraint_column public t3 b 2 2
  977. query TTTTTTTTTTT colnames
  978. SELECT * FROM information_schema.referential_constraints WHERE constraint_schema = 'public' ORDER BY TABLE_NAME, CONSTRAINT_NAME
  979. ----
  980. constraint_catalog constraint_schema constraint_name unique_constraint_catalog unique_constraint_schema unique_constraint_name match_option update_rule delete_rule table_name referenced_table_name
  981. constraint_column public fk constraint_column public t1_a_key NONE NO ACTION RESTRICT t2 t1
  982. constraint_column public fk2 constraint_column public index_key NONE CASCADE NO ACTION t3 t1
  983. statement ok
  984. DROP DATABASE constraint_column CASCADE
  985. ## information_schema.schema_privileges
  986. statement ok
  987. CREATE DATABASE other_db; SET DATABASE = other_db
  988. query TTTTT colnames
  989. SELECT * FROM information_schema.schema_privileges
  990. ----
  991. grantee table_catalog table_schema privilege_type is_grantable
  992. admin other_db crdb_internal ALL NULL
  993. root other_db crdb_internal ALL NULL
  994. admin other_db information_schema ALL NULL
  995. root other_db information_schema ALL NULL
  996. admin other_db pg_catalog ALL NULL
  997. root other_db pg_catalog ALL NULL
  998. admin other_db public ALL NULL
  999. root other_db public ALL NULL
  1000. statement ok
  1001. GRANT SELECT ON DATABASE other_db TO testuser
  1002. query TTTTT colnames
  1003. SELECT * FROM information_schema.schema_privileges
  1004. ----
  1005. grantee table_catalog table_schema privilege_type is_grantable
  1006. admin other_db crdb_internal ALL NULL
  1007. root other_db crdb_internal ALL NULL
  1008. testuser other_db crdb_internal SELECT NULL
  1009. admin other_db information_schema ALL NULL
  1010. root other_db information_schema ALL NULL
  1011. testuser other_db information_schema SELECT NULL
  1012. admin other_db pg_catalog ALL NULL
  1013. root other_db pg_catalog ALL NULL
  1014. testuser other_db pg_catalog SELECT NULL
  1015. admin other_db public ALL NULL
  1016. root other_db public ALL NULL
  1017. testuser other_db public SELECT NULL
  1018. ## information_schema.table_privileges and information_schema.role_table_grants
  1019. # root can see everything
  1020. query TTTTTTTT colnames,rowsort
  1021. SELECT * FROM system.information_schema.table_privileges ORDER BY table_schema, table_name, table_schema, grantee, privilege_type
  1022. ----
  1023. grantor grantee table_catalog table_schema table_name privilege_type is_grantable with_hierarchy
  1024. NULL public system crdb_internal backward_dependencies SELECT NULL YES
  1025. NULL public system crdb_internal builtin_functions SELECT NULL YES
  1026. NULL public system crdb_internal cluster_queries SELECT NULL YES
  1027. NULL public system crdb_internal cluster_sessions SELECT NULL YES
  1028. NULL public system crdb_internal cluster_settings SELECT NULL YES
  1029. NULL public system crdb_internal create_statements SELECT NULL YES
  1030. NULL public system crdb_internal feature_usage SELECT NULL YES
  1031. NULL public system crdb_internal forward_dependencies SELECT NULL YES
  1032. NULL public system crdb_internal gossip_alerts SELECT NULL YES
  1033. NULL public system crdb_internal gossip_liveness SELECT NULL YES
  1034. NULL public system crdb_internal gossip_network SELECT NULL YES
  1035. NULL public system crdb_internal gossip_nodes SELECT NULL YES
  1036. NULL public system crdb_internal index_columns SELECT NULL YES
  1037. NULL public system crdb_internal jobs SELECT NULL YES
  1038. NULL public system crdb_internal kv_node_status SELECT NULL YES
  1039. NULL public system crdb_internal kv_store_status SELECT NULL YES
  1040. NULL public system crdb_internal leases SELECT NULL YES
  1041. NULL public system crdb_internal node_build_info SELECT NULL YES
  1042. NULL public system crdb_internal node_metrics SELECT NULL YES
  1043. NULL public system crdb_internal node_queries SELECT NULL YES
  1044. NULL public system crdb_internal node_runtime_info SELECT NULL YES
  1045. NULL public system crdb_internal node_sessions SELECT NULL YES
  1046. NULL public system crdb_internal node_statement_statistics SELECT NULL YES
  1047. NULL public system crdb_internal partitions SELECT NULL YES
  1048. NULL public system crdb_internal predefined_comments SELECT NULL YES
  1049. NULL public system crdb_internal ranges SELECT NULL YES
  1050. NULL public system crdb_internal ranges_no_leases SELECT NULL YES
  1051. NULL public system crdb_internal schema_changes SELECT NULL YES
  1052. NULL public system crdb_internal session_trace SELECT NULL YES
  1053. NULL public system crdb_internal session_variables SELECT NULL YES
  1054. NULL public system crdb_internal table_columns SELECT NULL YES
  1055. NULL public system crdb_internal table_indexes SELECT NULL YES
  1056. NULL public system crdb_internal tables SELECT NULL YES
  1057. NULL public system crdb_internal zones SELECT NULL YES
  1058. NULL public system information_schema administrable_role_authorizations SELECT NULL YES
  1059. NULL public system information_schema applicable_roles SELECT NULL YES
  1060. NULL public system information_schema column_privileges SELECT NULL YES
  1061. NULL public system information_schema columns SELECT NULL YES
  1062. NULL public system information_schema constraint_column_usage SELECT NULL YES
  1063. NULL public system information_schema enabled_roles SELECT NULL YES
  1064. NULL public system information_schema key_column_usage SELECT NULL YES
  1065. NULL public system information_schema parameters SELECT NULL YES
  1066. NULL public system information_schema referential_constraints SELECT NULL YES
  1067. NULL public system information_schema role_table_grants SELECT NULL YES
  1068. NULL public system information_schema routines SELECT NULL YES
  1069. NULL public system information_schema schema_privileges SELECT NULL YES
  1070. NULL public system information_schema schemata SELECT NULL YES
  1071. NULL public system information_schema sequences SELECT NULL YES
  1072. NULL public system information_schema statistics SELECT NULL YES
  1073. NULL public system information_schema table_constraints SELECT NULL YES
  1074. NULL public system information_schema table_privileges SELECT NULL YES
  1075. NULL public system information_schema tables SELECT NULL YES
  1076. NULL public system information_schema user_privileges SELECT NULL YES
  1077. NULL public system information_schema views SELECT NULL YES
  1078. NULL public system pg_catalog pg_am SELECT NULL YES
  1079. NULL public system pg_catalog pg_attrdef SELECT NULL YES
  1080. NULL public system pg_catalog pg_attribute SELECT NULL YES
  1081. NULL public system pg_catalog pg_auth_members SELECT NULL YES
  1082. NULL public system pg_catalog pg_class SELECT NULL YES
  1083. NULL public system pg_catalog pg_collation SELECT NULL YES
  1084. NULL public system pg_catalog pg_constraint SELECT NULL YES
  1085. NULL public system pg_catalog pg_database SELECT NULL YES
  1086. NULL public system pg_catalog pg_depend SELECT NULL YES
  1087. NULL public system pg_catalog pg_description SELECT NULL YES
  1088. NULL public system pg_catalog pg_enum SELECT NULL YES
  1089. NULL public system pg_catalog pg_extension SELECT NULL YES
  1090. NULL public system pg_catalog pg_foreign_data_wrapper SELECT NULL YES
  1091. NULL public system pg_catalog pg_foreign_server SELECT NULL YES
  1092. NULL public system pg_catalog pg_foreign_table SELECT NULL YES
  1093. NULL public system pg_catalog pg_index SELECT NULL YES
  1094. NULL public system pg_catalog pg_indexes SELECT NULL YES
  1095. NULL public system pg_catalog pg_inherits SELECT NULL YES
  1096. NULL public system pg_catalog pg_language SELECT NULL YES
  1097. NULL public system pg_catalog pg_namespace SELECT NULL YES
  1098. NULL public system pg_catalog pg_operator SELECT NULL YES
  1099. NULL public system pg_catalog pg_proc SELECT NULL YES
  1100. NULL public system pg_catalog pg_range SELECT NULL YES
  1101. NULL public system pg_catalog pg_rewrite SELECT NULL YES
  1102. NULL public system pg_catalog pg_roles SELECT NULL YES
  1103. NULL public system pg_catalog pg_seclabel SELECT NULL YES
  1104. NULL public system pg_catalog pg_sequence SELECT NULL YES
  1105. NULL public system pg_catalog pg_settings SELECT NULL YES
  1106. NULL public system pg_catalog pg_shdescription SELECT NULL YES
  1107. NULL public system pg_catalog pg_shseclabel SELECT NULL YES
  1108. NULL public system pg_catalog pg_stat_activity SELECT NULL YES
  1109. NULL public system pg_catalog pg_tables SELECT NULL YES
  1110. NULL public system pg_catalog pg_tablespace SELECT NULL YES
  1111. NULL public system pg_catalog pg_trigger SELECT NULL YES
  1112. NULL public system pg_catalog pg_type SELECT NULL YES
  1113. NULL public system pg_catalog pg_user SELECT NULL YES
  1114. NULL public system pg_catalog pg_user_mapping SELECT NULL YES
  1115. NULL public system pg_catalog pg_views SELECT NULL YES
  1116. NULL admin system public comments DELETE NULL NO
  1117. NULL admin system public comments GRANT NULL NO
  1118. NULL admin system public comments INSERT NULL NO
  1119. NULL admin system public comments SELECT NULL YES
  1120. NULL admin system public comments UPDATE NULL NO
  1121. NULL public system public comments DELETE NULL NO
  1122. NULL public system public comments GRANT NULL NO
  1123. NULL public system public comments INSERT NULL NO
  1124. NULL public system public comments SELECT NULL YES
  1125. NULL public system public comments UPDATE NULL NO
  1126. NULL root system public comments DELETE NULL NO
  1127. NULL root system public comments GRANT NULL NO
  1128. NULL root system public comments INSERT NULL NO
  1129. NULL root system public comments SELECT NULL YES
  1130. NULL root system public comments UPDATE NULL NO
  1131. NULL admin system public descriptor GRANT NULL NO
  1132. NULL admin system public descriptor SELECT NULL YES
  1133. NULL root system public descriptor GRANT NULL NO
  1134. NULL root system public descriptor SELECT NULL YES
  1135. NULL admin system public eventlog DELETE NULL NO
  1136. NULL admin system public eventlog GRANT NULL NO
  1137. NULL admin system public eventlog INSERT NULL NO
  1138. NULL admin system public eventlog SELECT NULL YES
  1139. NULL admin system public eventlog UPDATE NULL NO
  1140. NULL root system public eventlog DELETE NULL NO
  1141. NULL root system public eventlog GRANT NULL NO
  1142. NULL root system public eventlog INSERT NULL NO
  1143. NULL root system public eventlog SELECT NULL YES
  1144. NULL root system public eventlog UPDATE NULL NO
  1145. NULL admin system public jobs DELETE NULL NO
  1146. NULL admin system public jobs GRANT NULL NO
  1147. NULL admin system public jobs INSERT NULL NO
  1148. NULL admin system public jobs SELECT NULL YES
  1149. NULL admin system public jobs UPDATE NULL NO
  1150. NULL root system public jobs DELETE NULL NO
  1151. NULL root system public jobs GRANT NULL NO
  1152. NULL root system public jobs INSERT NULL NO
  1153. NULL root system public jobs SELECT NULL YES
  1154. NULL root system public jobs UPDATE NULL NO
  1155. NULL admin system public lease DELETE NULL NO
  1156. NULL admin system public lease GRANT NULL NO
  1157. NULL admin system public lease INSERT NULL NO
  1158. NULL admin system public lease SELECT NULL YES
  1159. NULL admin system public lease UPDATE NULL NO
  1160. NULL root system public lease DELETE NULL NO
  1161. NULL root system public lease GRANT NULL NO
  1162. NULL root system public lease INSERT NULL NO
  1163. NULL root system public lease SELECT NULL YES
  1164. NULL root system public lease UPDATE NULL NO
  1165. NULL admin system public locations DELETE NULL NO
  1166. NULL admin system public locations GRANT NULL NO
  1167. NULL admin system public locations INSERT NULL NO
  1168. NULL admin system public locations SELECT NULL YES
  1169. NULL admin system public locations UPDATE NULL NO
  1170. NULL root system public locations DELETE NULL NO
  1171. NULL root system public locations GRANT NULL NO
  1172. NULL root system public locations INSERT NULL NO
  1173. NULL root system public locations SELECT NULL YES
  1174. NULL root system public locations UPDATE NULL NO
  1175. NULL admin system public namespace GRANT NULL NO
  1176. NULL admin system public namespace SELECT NULL YES
  1177. NULL root system public namespace GRANT NULL NO
  1178. NULL root system public namespace SELECT NULL YES
  1179. NULL admin system public rangelog DELETE NULL NO
  1180. NULL admin system public rangelog GRANT NULL NO
  1181. NULL admin system public rangelog INSERT NULL NO
  1182. NULL admin system public rangelog SELECT NULL YES
  1183. NULL admin system public rangelog UPDATE NULL NO
  1184. NULL root system public rangelog DELETE NULL NO
  1185. NULL root system public rangelog GRANT NULL NO
  1186. NULL root system public rangelog INSERT NULL NO
  1187. NULL root system public rangelog SELECT NULL YES
  1188. NULL root system public rangelog UPDATE NULL NO
  1189. NULL admin system public role_members DELETE NULL NO
  1190. NULL admin system public role_members GRANT NULL NO
  1191. NULL admin system public role_members INSERT NULL NO
  1192. NULL admin system public role_members SELECT NULL YES
  1193. NULL admin system public role_members UPDATE NULL NO
  1194. NULL root system public role_members DELETE NULL NO
  1195. NULL root system public role_members GRANT NULL NO
  1196. NULL root system public role_members INSERT NULL NO
  1197. NULL root system public role_members SELECT NULL YES
  1198. NULL root system public role_members UPDATE NULL NO
  1199. NULL admin system public settings DELETE NULL NO
  1200. NULL admin system public settings GRANT NULL NO
  1201. NULL admin system public settings INSERT NULL NO
  1202. NULL admin system public settings SELECT NULL YES
  1203. NULL admin system public settings UPDATE NULL NO
  1204. NULL root system public settings DELETE NULL NO
  1205. NULL root system public settings GRANT NULL NO
  1206. NULL root system public settings INSERT NULL NO
  1207. NULL root system public settings SELECT NULL YES
  1208. NULL root system public settings UPDATE NULL NO
  1209. NULL admin system public table_statistics DELETE NULL NO
  1210. NULL admin system public table_statistics GRANT NULL NO
  1211. NULL admin system public table_statistics INSERT NULL NO
  1212. NULL admin system public table_statistics SELECT NULL YES
  1213. NULL admin system public table_statistics UPDATE NULL NO
  1214. NULL root system public table_statistics DELETE NULL NO
  1215. NULL root system public table_statistics GRANT NULL NO
  1216. NULL root system public table_statistics INSERT NULL NO
  1217. NULL root system public table_statistics SELECT NULL YES
  1218. NULL root system public table_statistics UPDATE NULL NO
  1219. NULL admin system public ui DELETE NULL NO
  1220. NULL admin system public ui GRANT NULL NO
  1221. NULL admin system public ui INSERT NULL NO
  1222. NULL admin system public ui SELECT NULL YES
  1223. NULL admin system public ui UPDATE NULL NO
  1224. NULL root system public ui DELETE NULL NO
  1225. NULL root system public ui GRANT NULL NO
  1226. NULL root system public ui INSERT NULL NO
  1227. NULL root system public ui SELECT NULL YES
  1228. NULL root system public ui UPDATE NULL NO
  1229. NULL admin system public users DELETE NULL NO
  1230. NULL admin system public users GRANT NULL NO
  1231. NULL admin system public users INSERT NULL NO
  1232. NULL admin system public users SELECT NULL YES
  1233. NULL admin system public users UPDATE NULL NO
  1234. NULL root system public users DELETE NULL NO
  1235. NULL root system public users GRANT NULL NO
  1236. NULL root system public users INSERT NULL NO
  1237. NULL root system public users SELECT NULL YES
  1238. NULL root system public users UPDATE NULL NO
  1239. NULL admin system public web_sessions DELETE NULL NO
  1240. NULL admin system public web_sessions GRANT NULL NO
  1241. NULL admin system public web_sessions INSERT NULL NO
  1242. NULL admin system public web_sessions SELECT NULL YES
  1243. NULL admin system public web_sessions UPDATE NULL NO
  1244. NULL root system public web_sessions DELETE NULL NO
  1245. NULL root system public web_sessions GRANT NULL NO
  1246. NULL root system public web_sessions INSERT NULL NO
  1247. NULL root system public web_sessions SELECT NULL YES
  1248. NULL root system public web_sessions UPDATE NULL NO
  1249. NULL admin system public zones DELETE NULL NO
  1250. NULL admin system public zones GRANT NULL NO
  1251. NULL admin system public zones INSERT NULL NO
  1252. NULL admin system public zones SELECT NULL YES
  1253. NULL admin system public zones UPDATE NULL NO
  1254. NULL root system public zones DELETE NULL NO
  1255. NULL root system public zones GRANT NULL NO
  1256. NULL root system public zones INSERT NULL NO
  1257. NULL root system public zones SELECT NULL YES
  1258. NULL root system public zones UPDATE NULL NO
  1259. query TTTTTTTT colnames
  1260. SELECT * FROM system.information_schema.role_table_grants
  1261. ----
  1262. grantor grantee table_catalog table_schema table_name privilege_type is_grantable with_hierarchy
  1263. NULL public system crdb_internal backward_dependencies SELECT NULL YES
  1264. NULL public system crdb_internal builtin_functions SELECT NULL YES
  1265. NULL public system crdb_internal cluster_queries SELECT NULL YES
  1266. NULL public system crdb_internal cluster_sessions SELECT NULL YES
  1267. NULL public system crdb_internal cluster_settings SELECT NULL YES
  1268. NULL public system crdb_internal create_statements SELECT NULL YES
  1269. NULL public system crdb_internal feature_usage SELECT NULL YES
  1270. NULL public system crdb_internal forward_dependencies SELECT NULL YES
  1271. NULL public system crdb_internal gossip_alerts SELECT NULL YES
  1272. NULL public system crdb_internal gossip_liveness SELECT NULL YES
  1273. NULL public system crdb_internal gossip_network SELECT NULL YES
  1274. NULL public system crdb_internal gossip_nodes SELECT NULL YES
  1275. NULL public system crdb_internal index_columns SELECT NULL YES
  1276. NULL public system crdb_internal jobs SELECT NULL YES
  1277. NULL public system crdb_internal kv_node_status SELECT NULL YES
  1278. NULL public system crdb_internal kv_store_status SELECT NULL YES
  1279. NULL public system crdb_internal leases SELECT NULL YES
  1280. NULL public system crdb_internal node_build_info SELECT NULL YES
  1281. NULL public system crdb_internal node_metrics SELECT NULL YES
  1282. NULL public system crdb_internal node_queries SELECT NULL YES
  1283. NULL public system crdb_internal node_runtime_info SELECT NULL YES
  1284. NULL public system crdb_internal node_sessions SELECT NULL YES
  1285. NULL public system crdb_internal node_statement_statistics SELECT NULL YES
  1286. NULL public system crdb_internal partitions SELECT NULL YES
  1287. NULL public system crdb_internal predefined_comments SELECT NULL YES
  1288. NULL public system crdb_internal ranges SELECT NULL YES
  1289. NULL public system crdb_internal ranges_no_leases SELECT NULL YES
  1290. NULL public system crdb_internal schema_changes SELECT NULL YES
  1291. NULL public system crdb_internal session_trace SELECT NULL YES
  1292. NULL public system crdb_internal session_variables SELECT NULL YES
  1293. NULL public system crdb_internal table_columns SELECT NULL YES
  1294. NULL public system crdb_internal table_indexes SELECT NULL YES
  1295. NULL public system crdb_internal tables SELECT NULL YES
  1296. NULL public system crdb_internal zones SELECT NULL YES
  1297. NULL public system information_schema administrable_role_authorizations SELECT NULL YES
  1298. NULL public system information_schema applicable_roles SELECT NULL YES
  1299. NULL public system information_schema column_privileges SELECT NULL YES
  1300. NULL public system information_schema columns SELECT NULL YES
  1301. NULL public system information_schema constraint_column_usage SELECT NULL YES
  1302. NULL public system information_schema enabled_roles SELECT NULL YES
  1303. NULL public system information_schema key_column_usage SELECT NULL YES
  1304. NULL public system information_schema parameters SELECT NULL YES
  1305. NULL public system information_schema referential_constraints SELECT NULL YES
  1306. NULL public system information_schema role_table_grants SELECT NULL YES
  1307. NULL public system information_schema routines SELECT NULL YES
  1308. NULL public system information_schema schema_privileges SELECT NULL YES
  1309. NULL public system information_schema schemata SELECT NULL YES
  1310. NULL public system information_schema sequences SELECT NULL YES
  1311. NULL public system information_schema statistics SELECT NULL YES
  1312. NULL public system information_schema table_constraints SELECT NULL YES
  1313. NULL public system information_schema table_privileges SELECT NULL YES
  1314. NULL public system information_schema tables SELECT NULL YES
  1315. NULL public system information_schema user_privileges SELECT NULL YES
  1316. NULL public system information_schema views SELECT NULL YES
  1317. NULL public system pg_catalog pg_am SELECT NULL YES
  1318. NULL public system pg_catalog pg_attrdef SELECT NULL YES
  1319. NULL public system pg_catalog pg_attribute SELECT NULL YES
  1320. NULL public system pg_catalog pg_auth_members SELECT NULL YES
  1321. NULL public system pg_catalog pg_class SELECT NULL YES
  1322. NULL public system pg_catalog pg_collation SELECT NULL YES
  1323. NULL public system pg_catalog pg_constraint SELECT NULL YES
  1324. NULL public system pg_catalog pg_database SELECT NULL YES
  1325. NULL public system pg_catalog pg_depend SELECT NULL YES
  1326. NULL public system pg_catalog pg_description SELECT NULL YES
  1327. NULL public system pg_catalog pg_enum SELECT NULL YES
  1328. NULL public system pg_catalog pg_extension SELECT NULL YES
  1329. NULL public system pg_catalog pg_foreign_data_wrapper SELECT NULL YES
  1330. NULL public system pg_catalog pg_foreign_server SELECT NULL YES
  1331. NULL public system pg_catalog pg_foreign_table SELECT NULL YES
  1332. NULL public system pg_catalog pg_index SELECT NULL YES
  1333. NULL public system pg_catalog pg_indexes SELECT NULL YES
  1334. NULL public system pg_catalog pg_inherits SELECT NULL YES
  1335. NULL public system pg_catalog pg_language SELECT NULL YES
  1336. NULL public system pg_catalog pg_namespace SELECT NULL YES
  1337. NULL public system pg_catalog pg_operator SELECT NULL YES
  1338. NULL public system pg_catalog pg_proc SELECT NULL YES
  1339. NULL public system pg_catalog pg_range SELECT NULL YES
  1340. NULL public system pg_catalog pg_rewrite SELECT NULL YES
  1341. NULL public system pg_catalog pg_roles SELECT NULL YES
  1342. NULL public system pg_catalog pg_seclabel SELECT NULL YES
  1343. NULL public system pg_catalog pg_sequence SELECT NULL YES
  1344. NULL public system pg_catalog pg_settings SELECT NULL YES
  1345. NULL public system pg_catalog pg_shdescription SELECT NULL YES
  1346. NULL public system pg_catalog pg_shseclabel SELECT NULL YES
  1347. NULL public system pg_catalog pg_stat_activity SELECT NULL YES
  1348. NULL public system pg_catalog pg_tables SELECT NULL YES
  1349. NULL public system pg_catalog pg_tablespace SELECT NULL YES
  1350. NULL public system pg_catalog pg_trigger SELECT NULL YES
  1351. NULL public system pg_catalog pg_type SELECT NULL YES
  1352. NULL public system pg_catalog pg_user SELECT NULL YES
  1353. NULL public system pg_catalog pg_user_mapping SELECT NULL YES
  1354. NULL public system pg_catalog pg_views SELECT NULL YES
  1355. NULL admin system public namespace GRANT NULL NO
  1356. NULL admin system public namespace SELECT NULL YES
  1357. NULL root system public namespace GRANT NULL NO
  1358. NULL root system public namespace SELECT NULL YES
  1359. NULL admin system public descriptor GRANT NULL NO
  1360. NULL admin system public descriptor SELECT NULL YES
  1361. NULL root system public descriptor GRANT NULL NO
  1362. NULL root system public descriptor SELECT NULL YES
  1363. NULL admin system public users DELETE NULL NO
  1364. NULL admin system public users GRANT NULL NO
  1365. NULL admin system public users INSERT NULL NO
  1366. NULL admin system public users SELECT NULL YES
  1367. NULL admin system public users UPDATE NULL NO
  1368. NULL root system public users DELETE NULL NO
  1369. NULL root system public users GRANT NULL NO
  1370. NULL root system public users INSERT NULL NO
  1371. NULL root system public users SELECT NULL YES
  1372. NULL root system public users UPDATE NULL NO
  1373. NULL admin system public zones DELETE NULL NO
  1374. NULL admin system public zones GRANT NULL NO
  1375. NULL admin system public zones INSERT NULL NO
  1376. NULL admin system public zones SELECT NULL YES
  1377. NULL admin system public zones UPDATE NULL NO
  1378. NULL root system public zones DELETE NULL NO
  1379. NULL root system public zones GRANT NULL NO
  1380. NULL root system public zones INSERT NULL NO
  1381. NULL root system public zones SELECT NULL YES
  1382. NULL root system public zones UPDATE NULL NO
  1383. NULL admin system public settings DELETE NULL NO
  1384. NULL admin system public settings GRANT NULL NO
  1385. NULL admin system public settings INSERT NULL NO
  1386. NULL admin system public settings SELECT NULL YES
  1387. NULL admin system public settings UPDATE NULL NO
  1388. NULL root system public settings DELETE NULL NO
  1389. NULL root system public settings GRANT NULL NO
  1390. NULL root system public settings INSERT NULL NO
  1391. NULL root system public settings SELECT NULL YES
  1392. NULL root system public settings UPDATE NULL NO
  1393. NULL admin system public lease DELETE NULL NO
  1394. NULL admin system public lease GRANT NULL NO
  1395. NULL admin system public lease INSERT NULL NO
  1396. NULL admin system public lease SELECT NULL YES
  1397. NULL admin system public lease UPDATE NULL NO
  1398. NULL root system public lease DELETE NULL NO
  1399. NULL root system public lease GRANT NULL NO
  1400. NULL root system public lease INSERT NULL NO
  1401. NULL root system public lease SELECT NULL YES
  1402. NULL root system public lease UPDATE NULL NO
  1403. NULL admin system public eventlog DELETE NULL NO
  1404. NULL admin system public eventlog GRANT NULL NO
  1405. NULL admin system public eventlog INSERT NULL NO
  1406. NULL admin system public eventlog SELECT NULL YES
  1407. NULL admin system public eventlog UPDATE NULL NO
  1408. NULL root system public eventlog DELETE NULL NO
  1409. NULL root system public eventlog GRANT NULL NO
  1410. NULL root system public eventlog INSERT NULL NO
  1411. NULL root system public eventlog SELECT NULL YES
  1412. NULL root system public eventlog UPDATE NULL NO
  1413. NULL admin system public rangelog DELETE NULL NO
  1414. NULL admin system public rangelog GRANT NULL NO
  1415. NULL admin system public rangelog INSERT NULL NO
  1416. NULL admin system public rangelog SELECT NULL YES
  1417. NULL admin system public rangelog UPDATE NULL NO
  1418. NULL root system public rangelog DELETE NULL NO
  1419. NULL root system public rangelog GRANT NULL NO
  1420. NULL root system public rangelog INSERT NULL NO
  1421. NULL root system public rangelog SELECT NULL YES
  1422. NULL root system public rangelog UPDATE NULL NO
  1423. NULL admin system public ui DELETE NULL NO
  1424. NULL admin system public ui GRANT NULL NO
  1425. NULL admin system public ui INSERT NULL NO
  1426. NULL admin system public ui SELECT NULL YES
  1427. NULL admin system public ui UPDATE NULL NO
  1428. NULL root system public ui DELETE NULL NO
  1429. NULL root system public ui GRANT NULL NO
  1430. NULL root system public ui INSERT NULL NO
  1431. NULL root system public ui SELECT NULL YES
  1432. NULL root system public ui UPDATE NULL NO
  1433. NULL admin system public jobs DELETE NULL NO
  1434. NULL admin system public jobs GRANT NULL NO
  1435. NULL admin system public jobs INSERT NULL NO
  1436. NULL admin system public jobs SELECT NULL YES
  1437. NULL admin system public jobs UPDATE NULL NO
  1438. NULL root system public jobs DELETE NULL NO
  1439. NULL root system public jobs GRANT NULL NO
  1440. NULL root system public jobs INSERT NULL NO
  1441. NULL root system public jobs SELECT NULL YES
  1442. NULL root system public jobs UPDATE NULL NO
  1443. NULL admin system public web_sessions DELETE NULL NO
  1444. NULL admin system public web_sessions GRANT NULL NO
  1445. NULL admin system public web_sessions INSERT NULL NO
  1446. NULL admin system public web_sessions SELECT NULL YES
  1447. NULL admin system public web_sessions UPDATE NULL NO
  1448. NULL root system public web_sessions DELETE NULL NO
  1449. NULL root system public web_sessions GRANT NULL NO
  1450. NULL root system public web_sessions INSERT NULL NO
  1451. NULL root system public web_sessions SELECT NULL YES
  1452. NULL root system public web_sessions UPDATE NULL NO
  1453. NULL admin system public table_statistics DELETE NULL NO
  1454. NULL admin system public table_statistics GRANT NULL NO
  1455. NULL admin system public table_statistics INSERT NULL NO
  1456. NULL admin system public table_statistics SELECT NULL YES
  1457. NULL admin system public table_statistics UPDATE NULL NO
  1458. NULL root system public table_statistics DELETE NULL NO
  1459. NULL root system public table_statistics GRANT NULL NO
  1460. NULL root system public table_statistics INSERT NULL NO
  1461. NULL root system public table_statistics SELECT NULL YES
  1462. NULL root system public table_statistics UPDATE NULL NO
  1463. NULL admin system public locations DELETE NULL NO
  1464. NULL admin system public locations GRANT NULL NO
  1465. NULL admin system public locations INSERT NULL NO
  1466. NULL admin system public locations SELECT NULL YES
  1467. NULL admin system public locations UPDATE NULL NO
  1468. NULL root system public locations DELETE NULL NO
  1469. NULL root system public locations GRANT NULL NO
  1470. NULL root system public locations INSERT NULL NO
  1471. NULL root system public locations SELECT NULL YES
  1472. NULL root system public locations UPDATE NULL NO
  1473. NULL admin system public role_members DELETE NULL NO
  1474. NULL admin system public role_members GRANT NULL NO
  1475. NULL admin system public role_members INSERT NULL NO
  1476. NULL admin system public role_members SELECT NULL YES
  1477. NULL admin system public role_members UPDATE NULL NO
  1478. NULL root system public role_members DELETE NULL NO
  1479. NULL root system public role_members GRANT NULL NO
  1480. NULL root system public role_members INSERT NULL NO
  1481. NULL root system public role_members SELECT NULL YES
  1482. NULL root system public role_members UPDATE NULL NO
  1483. NULL admin system public comments DELETE NULL NO
  1484. NULL admin system public comments GRANT NULL NO
  1485. NULL admin system public comments INSERT NULL NO
  1486. NULL admin system public comments SELECT NULL YES
  1487. NULL admin system public comments UPDATE NULL NO
  1488. NULL public system public comments DELETE NULL NO
  1489. NULL public system public comments GRANT NULL NO
  1490. NULL public system public comments INSERT NULL NO
  1491. NULL public system public comments SELECT NULL YES
  1492. NULL public system public comments UPDATE NULL NO
  1493. NULL root system public comments DELETE NULL NO
  1494. NULL root system public comments GRANT NULL NO
  1495. NULL root system public comments INSERT NULL NO
  1496. NULL root system public comments SELECT NULL YES
  1497. NULL root system public comments UPDATE NULL NO
  1498. statement ok
  1499. CREATE TABLE other_db.xyz (i INT)
  1500. statement ok
  1501. CREATE VIEW other_db.abc AS SELECT i from other_db.xyz
  1502. query TTTTTTTT colnames
  1503. SELECT * FROM other_db.information_schema.table_privileges WHERE TABLE_SCHEMA = 'public'
  1504. ----
  1505. grantor grantee table_catalog table_schema table_name privilege_type is_grantable with_hierarchy
  1506. NULL admin other_db public xyz ALL NULL NO
  1507. NULL root other_db public xyz ALL NULL NO
  1508. NULL testuser other_db public xyz SELECT NULL YES
  1509. NULL admin other_db public abc ALL NULL NO
  1510. NULL root other_db public abc ALL NULL NO
  1511. NULL testuser other_db public abc SELECT NULL YES
  1512. query TTTTTTTT colnames
  1513. SELECT * FROM other_db.information_schema.role_table_grants WHERE TABLE_SCHEMA = 'public'
  1514. ----
  1515. grantor grantee table_catalog table_schema table_name privilege_type is_grantable with_hierarchy
  1516. NULL admin other_db public xyz ALL NULL NO
  1517. NULL root other_db public xyz ALL NULL NO
  1518. NULL testuser other_db public xyz SELECT NULL YES
  1519. NULL admin other_db public abc ALL NULL NO
  1520. NULL root other_db public abc ALL NULL NO
  1521. NULL testuser other_db public abc SELECT NULL YES
  1522. statement ok
  1523. GRANT UPDATE ON other_db.xyz TO testuser
  1524. query TTTTTTTT colnames
  1525. SELECT * FROM other_db.information_schema.table_privileges WHERE TABLE_SCHEMA = 'public'
  1526. ----
  1527. grantor grantee table_catalog table_schema table_name privilege_type is_grantable with_hierarchy
  1528. NULL admin other_db public xyz ALL NULL NO
  1529. NULL root other_db public xyz ALL NULL NO
  1530. NULL testuser other_db public xyz SELECT NULL YES
  1531. NULL testuser other_db public xyz UPDATE NULL NO
  1532. NULL admin other_db public abc ALL NULL NO
  1533. NULL root other_db public abc ALL NULL NO
  1534. NULL testuser other_db public abc SELECT NULL YES
  1535. query TTTTTTTT colnames
  1536. SELECT * FROM other_db.information_schema.role_table_grants WHERE TABLE_SCHEMA = 'public'
  1537. ----
  1538. grantor grantee table_catalog table_schema table_name privilege_type is_grantable with_hierarchy
  1539. NULL admin other_db public xyz ALL NULL NO
  1540. NULL root other_db public xyz ALL NULL NO
  1541. NULL testuser other_db public xyz SELECT NULL YES
  1542. NULL testuser other_db public xyz UPDATE NULL NO
  1543. NULL admin other_db public abc ALL NULL NO
  1544. NULL root other_db public abc ALL NULL NO
  1545. NULL testuser other_db public abc SELECT NULL YES
  1546. # testuser can read permissions as well
  1547. user testuser
  1548. statement ok
  1549. SET DATABASE = other_db
  1550. query TTTTTTTT colnames
  1551. SELECT * FROM information_schema.table_privileges WHERE TABLE_SCHEMA = 'public'
  1552. ----
  1553. grantor grantee table_catalog table_schema table_name privilege_type is_grantable with_hierarchy
  1554. NULL admin other_db public xyz ALL NULL NO
  1555. NULL root other_db public xyz ALL NULL NO
  1556. NULL testuser other_db public xyz SELECT NULL YES
  1557. NULL testuser other_db public xyz UPDATE NULL NO
  1558. NULL admin other_db public abc ALL NULL NO
  1559. NULL root other_db public abc ALL NULL NO
  1560. NULL testuser other_db public abc SELECT NULL YES
  1561. query TTTTTTTT colnames
  1562. SELECT * FROM information_schema.role_table_grants WHERE TABLE_SCHEMA = 'public'
  1563. ----
  1564. grantor grantee table_catalog table_schema table_name privilege_type is_grantable with_hierarchy
  1565. NULL admin other_db public xyz ALL NULL NO
  1566. NULL root other_db public xyz ALL NULL NO
  1567. NULL testuser other_db public xyz SELECT NULL YES
  1568. NULL testuser other_db public xyz UPDATE NULL NO
  1569. NULL admin other_db public abc ALL NULL NO
  1570. NULL root other_db public abc ALL NULL NO
  1571. NULL testuser other_db public abc SELECT NULL YES
  1572. statement ok
  1573. SET DATABASE = test
  1574. user root
  1575. ## information_schema.statistics
  1576. statement ok
  1577. CREATE TABLE other_db.teststatics(id INT PRIMARY KEY, c INT, d INT, e STRING, INDEX idx_c(c), UNIQUE INDEX idx_cd(c,d))
  1578. query TTTTTTITIITTT colnames
  1579. SELECT * FROM other_db.information_schema.statistics WHERE table_schema='public' AND table_name='teststatics' ORDER BY INDEX_SCHEMA,INDEX_NAME,SEQ_IN_INDEX
  1580. ----
  1581. table_catalog table_schema table_name non_unique index_schema index_name seq_in_index column_name COLLATION cardinality direction storing implicit
  1582. other_db public teststatics YES public idx_c 1 c NULL NULL ASC NO NO
  1583. other_db public teststatics YES public idx_c 2 id NULL NULL ASC NO YES
  1584. other_db public teststatics NO public idx_cd 1 c NULL NULL ASC NO NO
  1585. other_db public teststatics NO public idx_cd 2 d NULL NULL ASC NO NO
  1586. other_db public teststatics NO public idx_cd 3 id NULL NULL ASC NO YES
  1587. other_db public teststatics NO public primary 1 id NULL NULL ASC NO NO
  1588. # Verify information_schema.views
  1589. statement ok
  1590. CREATE VIEW other_db.v_xyz AS SELECT i FROM other_db.xyz
  1591. query TTTTT colnames
  1592. SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, VIEW_DEFINITION, CHECK_OPTION
  1593. FROM other_db.information_schema.views
  1594. WHERE TABLE_NAME='v_xyz'
  1595. ----
  1596. table_catalog table_schema table_name view_definition check_option
  1597. other_db public v_xyz SELECT i FROM other_db.public.xyz NULL
  1598. query TTTTT colnames
  1599. SELECT IS_UPDATABLE, IS_INSERTABLE_INTO, IS_TRIGGER_UPDATABLE, IS_TRIGGER_DELETABLE, IS_TRIGGER_INSERTABLE_INTO
  1600. FROM other_db.information_schema.views
  1601. WHERE TABLE_NAME='v_xyz'
  1602. ----
  1603. is_updatable is_insertable_into is_trigger_updatable is_trigger_deletable is_trigger_insertable_into
  1604. NO NO NO NO NO
  1605. statement ok
  1606. SET DATABASE = 'test'
  1607. statement ok
  1608. DROP DATABASE other_db CASCADE
  1609. #Verify information_schema.user_privileges
  1610. query TTTT colnames,rowsort
  1611. SELECT * FROM information_schema.user_privileges ORDER BY grantee,privilege_type
  1612. ----
  1613. grantee table_catalog privilege_type is_grantable
  1614. admin test ALL NULL
  1615. admin test CREATE NULL
  1616. admin test DELETE NULL
  1617. admin test DROP NULL
  1618. admin test GRANT NULL
  1619. admin test INSERT NULL
  1620. admin test SELECT NULL
  1621. admin test UPDATE NULL
  1622. root test ALL NULL
  1623. root test CREATE NULL
  1624. root test DELETE NULL
  1625. root test DROP NULL
  1626. root test GRANT NULL
  1627. root test INSERT NULL
  1628. root test SELECT NULL
  1629. root test UPDATE NULL
  1630. # information_schema.sequences
  1631. statement ok
  1632. SET DATABASE = test
  1633. query TTTTIIITTTTT
  1634. SELECT * FROM information_schema.sequences
  1635. ----
  1636. statement ok
  1637. CREATE SEQUENCE test_seq
  1638. statement ok
  1639. CREATE SEQUENCE test_seq_2 INCREMENT -1 MINVALUE 5 MAXVALUE 1000 START WITH 15
  1640. query TTTTIIITTTTT colnames
  1641. SELECT * FROM information_schema.sequences
  1642. ----
  1643. sequence_catalog sequence_schema sequence_name data_type numeric_precision numeric_precision_radix numeric_scale start_value minimum_value maximum_value increment cycle_option
  1644. test public test_seq bigint 64 2 0 1 1 9223372036854775807 1 NO
  1645. test public test_seq_2 bigint 64 2 0 15 5 1000 -1 NO
  1646. statement ok
  1647. CREATE DATABASE other_db
  1648. statement ok
  1649. SET DATABASE = other_db
  1650. # Sequences in one database can't be seen from another database.
  1651. query TTTTIIITTTTT
  1652. SELECT * FROM information_schema.sequences
  1653. ----
  1654. statement ok
  1655. SET DATABASE = test
  1656. statement ok
  1657. DROP DATABASE other_db CASCADE
  1658. # test information_schema.column_privileges
  1659. query TTBTTTB colnames
  1660. SHOW COLUMNS FROM information_schema.column_privileges
  1661. ----
  1662. column_name data_type is_nullable column_default generation_expression indices is_hidden
  1663. grantor STRING true NULL · {} false
  1664. grantee STRING false NULL · {} false
  1665. table_catalog STRING false NULL · {} false
  1666. table_schema STRING false NULL · {} false
  1667. table_name STRING false NULL · {} false
  1668. column_name STRING false NULL · {} false
  1669. privilege_type STRING false NULL · {} false
  1670. is_grantable STRING true NULL · {} false
  1671. # test information_schema.routines
  1672. query TTBTTTB colnames
  1673. SHOW COLUMNS FROM information_schema.routines
  1674. ----
  1675. column_name data_type is_nullable column_default generation_expression indices is_hidden
  1676. specific_catalog STRING true NULL · {} false
  1677. specific_schema STRING true NULL · {} false
  1678. specific_name STRING true NULL · {} false
  1679. routine_catalog STRING true NULL · {} false
  1680. routine_schema STRING true NULL · {} false
  1681. routine_name STRING true NULL · {} false
  1682. routine_type STRING true NULL · {} false
  1683. module_catalog STRING true NULL · {} false
  1684. module_schema STRING true NULL · {} false
  1685. module_name STRING true NULL · {} false
  1686. udt_catalog STRING true NULL · {} false
  1687. udt_schema STRING true NULL · {} false
  1688. udt_name STRING true NULL · {} false
  1689. data_type STRING true NULL · {} false
  1690. character_maximum_length INT8 true NULL · {} false
  1691. character_octet_length INT8 true NULL · {} false
  1692. character_set_catalog STRING true NULL · {} false
  1693. character_set_schema STRING true NULL · {} false
  1694. character_set_name STRING true NULL · {} false
  1695. collation_catalog STRING true NULL · {} false
  1696. collation_schema STRING true NULL · {} false
  1697. collation_name STRING true NULL · {} false
  1698. numeric_precision INT8 true NULL · {} false
  1699. numeric_precision_radix INT8 true NULL · {} false
  1700. numeric_scale INT8 true NULL · {} false
  1701. datetime_precision INT8 true NULL · {} false
  1702. interval_type STRING true NULL · {} false
  1703. interval_precision STRING true NULL · {} false
  1704. type_udt_catalog STRING true NULL · {} false
  1705. type_udt_schema STRING true NULL · {} false
  1706. type_udt_name STRING true NULL · {} false
  1707. scope_catalog STRING true NULL · {} false
  1708. scope_name STRING true NULL · {} false
  1709. maximum_cardinality INT8 true NULL · {} false
  1710. dtd_identifier STRING true NULL · {} false
  1711. routine_body STRING true NULL · {} false
  1712. routine_definition STRING true NULL · {} false
  1713. external_name STRING true NULL · {} false
  1714. external_language STRING true NULL · {} false
  1715. parameter_style STRING true NULL · {} false
  1716. is_deterministic STRING true NULL · {} false
  1717. sql_data_access STRING true NULL · {} false
  1718. is_null_call STRING true NULL · {} false
  1719. sql_path STRING true NULL · {} false
  1720. schema_level_routine STRING true NULL · {} false
  1721. max_dynamic_result_sets INT8 true NULL · {} false
  1722. is_user_defined_cast STRING true NULL · {} false
  1723. is_implicitly_invocable STRING true NULL · {} false
  1724. security_type STRING true NULL · {} false
  1725. to_sql_specific_catalog STRING true NULL · {} false
  1726. to_sql_specific_schema STRING true NULL · {} false
  1727. to_sql_specific_name STRING true NULL · {} false
  1728. as_locator STRING true NULL · {} false
  1729. created TIMESTAMPTZ true NULL · {} false
  1730. last_altered TIMESTAMPTZ true NULL · {} false
  1731. new_savepoint_level STRING true NULL · {} false
  1732. is_udt_dependent STRING true NULL · {} false
  1733. result_cast_from_data_type STRING true NULL · {} false
  1734. result_cast_as_locator STRING true NULL · {} false
  1735. result_cast_char_max_length INT8 true NULL · {} false
  1736. result_cast_char_octet_length STRING true NULL · {} false
  1737. result_cast_char_set_catalog STRING true NULL · {} false
  1738. result_cast_char_set_schema STRING true NULL · {} false
  1739. result_cast_char_set_name STRING true NULL · {} false
  1740. result_cast_collation_catalog STRING true NULL · {} false
  1741. result_cast_collation_schema STRING true NULL · {} false
  1742. result_cast_collation_name STRING true NULL · {} false
  1743. result_cast_numeric_precision INT8 true NULL · {} false
  1744. result_cast_numeric_precision_radix INT8 true NULL · {} false
  1745. result_cast_numeric_scale INT8 true NULL · {} false
  1746. result_cast_datetime_precision STRING true NULL · {} false
  1747. result_cast_interval_type STRING true NULL · {} false
  1748. result_cast_interval_precision INT8 true NULL · {} false
  1749. result_cast_type_udt_catalog STRING true NULL · {} false
  1750. result_cast_type_udt_schema STRING true NULL · {} false
  1751. result_cast_type_udt_name STRING true NULL · {} false
  1752. result_cast_scope_catalog STRING true NULL · {} false
  1753. result_cast_scope_schema STRING true NULL · {} false
  1754. result_cast_scope_name STRING true NULL · {} false
  1755. result_cast_maximum_cardinality INT8 true NULL · {} false
  1756. result_cast_dtd_identifier STRING true NULL · {} false
  1757. query TTTTTTTTTTTTTTIITTTTTTIIIITTTTTTTITTTTTTTTTTTITTTTTTTTTTTTTITTTTTTTIIITTITTTTTTIT colnames
  1758. SELECT * FROM information_schema.routines
  1759. ----
  1760. specific_catalog specific_schema specific_name routine_catalog routine_schema routine_name routine_type module_catalog module_schema module_name udt_catalog udt_schema udt_name data_type character_maximum_length character_octet_length character_set_catalog character_set_schema character_set_name collation_catalog collation_schema collation_name numeric_precision numeric_precision_radix numeric_scale datetime_precision interval_type interval_precision type_udt_catalog type_udt_schema type_udt_name scope_catalog scope_name maximum_cardinality dtd_identifier routine_body routine_definition external_name external_language parameter_style is_deterministic sql_data_access is_null_call sql_path schema_level_routine max_dynamic_result_sets is_user_defined_cast is_implicitly_invocable security_type to_sql_specific_catalog to_sql_specific_schema to_sql_specific_name as_locator created last_altered new_savepoint_level is_udt_dependent result_cast_from_data_type result_cast_as_locator result_cast_char_max_length result_cast_char_octet_length result_cast_char_set_catalog result_cast_char_set_schema result_cast_char_set_name result_cast_collation_catalog result_cast_collation_schema result_cast_collation_name result_cast_numeric_precision result_cast_numeric_precision_radix result_cast_numeric_scale result_cast_datetime_precision result_cast_interval_type result_cast_interval_precision result_cast_type_udt_catalog result_cast_type_udt_schema result_cast_type_udt_name result_cast_scope_catalog result_cast_scope_schema result_cast_scope_name result_cast_maximum_cardinality result_cast_dtd_identifier
  1761. # test information_schema.parameters
  1762. query TTBTTTB colnames
  1763. SHOW COLUMNS FROM information_schema.parameters
  1764. ----
  1765. column_name data_type is_nullable column_default generation_expression indices is_hidden
  1766. specific_catalog STRING true NULL · {} false
  1767. specific_schema STRING true NULL · {} false
  1768. specific_name STRING true NULL · {} false
  1769. ordinal_position INT8 true NULL · {} false
  1770. parameter_mode STRING true NULL · {} false
  1771. is_result STRING true NULL · {} false
  1772. as_locator STRING true NULL · {} false
  1773. parameter_name STRING true NULL · {} false
  1774. data_type STRING true NULL · {} false
  1775. character_maximum_length INT8 true NULL · {} false
  1776. character_octet_length INT8 true NULL · {} false
  1777. character_set_catalog STRING true NULL · {} false
  1778. character_set_schema STRING true NULL · {} false
  1779. character_set_name STRING true NULL · {} false
  1780. collation_catalog STRING true NULL · {} false
  1781. collation_schema STRING true NULL · {} false
  1782. collation_name STRING true NULL · {} false
  1783. numeric_precision INT8 true NULL · {} false
  1784. numeric_precision_radix INT8 true NULL · {} false
  1785. numeric_scale INT8 true NULL · {} false
  1786. datetime_precision INT8 true NULL · {} false
  1787. interval_type STRING true NULL · {} false
  1788. interval_precision INT8 true NULL · {} false
  1789. udt_catalog STRING true NULL · {} false
  1790. udt_schema STRING true NULL · {} false
  1791. udt_name STRING true NULL · {} false
  1792. scope_catalog STRING true NULL · {} false
  1793. scope_schema STRING true NULL · {} false
  1794. scope_name STRING true NULL · {} false
  1795. maximum_cardinality INT8 true NULL · {} false
  1796. dtd_identifier STRING true NULL · {} false
  1797. parameter_default STRING true NULL · {} false
  1798. query TTTITTTTTIITTTTTTIIIITITTTTTTITT colnames
  1799. SELECT * FROM information_schema.parameters
  1800. ----
  1801. specific_catalog specific_schema specific_name ordinal_position parameter_mode is_result as_locator parameter_name data_type character_maximum_length character_octet_length character_set_catalog character_set_schema character_set_name collation_catalog collation_schema collation_name numeric_precision numeric_precision_radix numeric_scale datetime_precision interval_type interval_precision udt_catalog udt_schema udt_name scope_catalog scope_schema scope_name maximum_cardinality dtd_identifier parameter_default
  1802. query TTTTTTTT colnames
  1803. SELECT * FROM system.information_schema.column_privileges WHERE table_name = 'eventlog'
  1804. ----
  1805. grantor grantee table_catalog table_schema table_name column_name privilege_type is_grantable
  1806. NULL admin system public eventlog timestamp SELECT NULL
  1807. NULL admin system public eventlog eventType SELECT NULL
  1808. NULL admin system public eventlog targetID SELECT NULL
  1809. NULL admin system public eventlog reportingID SELECT NULL
  1810. NULL admin system public eventlog info SELECT NULL
  1811. NULL admin system public eventlog uniqueID SELECT NULL
  1812. NULL admin system public eventlog timestamp INSERT NULL
  1813. NULL admin system public eventlog eventType INSERT NULL
  1814. NULL admin system public eventlog targetID INSERT NULL
  1815. NULL admin system public eventlog reportingID INSERT NULL
  1816. NULL admin system public eventlog info INSERT NULL
  1817. NULL admin system public eventlog uniqueID INSERT NULL
  1818. NULL admin system public eventlog timestamp UPDATE NULL
  1819. NULL admin system public eventlog eventType UPDATE NULL
  1820. NULL admin system public eventlog targetID UPDATE NULL
  1821. NULL admin system public eventlog reportingID UPDATE NULL
  1822. NULL admin system public eventlog info UPDATE NULL
  1823. NULL admin system public eventlog uniqueID UPDATE NULL
  1824. NULL root system public eventlog timestamp SELECT NULL
  1825. NULL root system public eventlog eventType SELECT NULL
  1826. NULL root system public eventlog targetID SELECT NULL
  1827. NULL root system public eventlog reportingID SELECT NULL
  1828. NULL root system public eventlog info SELECT NULL
  1829. NULL root system public eventlog uniqueID SELECT NULL
  1830. NULL root system public eventlog timestamp INSERT NULL
  1831. NULL root system public eventlog eventType INSERT NULL
  1832. NULL root system public eventlog targetID INSERT NULL
  1833. NULL root system public eventlog reportingID INSERT NULL
  1834. NULL root system public eventlog info INSERT NULL
  1835. NULL root system public eventlog uniqueID INSERT NULL
  1836. NULL root system public eventlog timestamp UPDATE NULL
  1837. NULL root system public eventlog eventType UPDATE NULL
  1838. NULL root system public eventlog targetID UPDATE NULL
  1839. NULL root system public eventlog reportingID UPDATE NULL
  1840. NULL root system public eventlog info UPDATE NULL
  1841. NULL root system public eventlog uniqueID UPDATE NULL
  1842. # information_schema.administrable_role_authorizations
  1843. query TTT colnames,rowsort
  1844. SELECT * FROM information_schema.administrable_role_authorizations
  1845. ----
  1846. grantee role_name is_grantable
  1847. root admin YES
  1848. user testuser
  1849. query TTT colnames,rowsort
  1850. SELECT * FROM information_schema.administrable_role_authorizations
  1851. ----
  1852. grantee role_name is_grantable
  1853. user root
  1854. # information_schema.applicable_roles
  1855. query TTT colnames,rowsort
  1856. SELECT * FROM information_schema.applicable_roles
  1857. ----
  1858. grantee role_name is_grantable
  1859. root admin YES
  1860. user testuser
  1861. query TTT colnames,rowsort
  1862. SELECT * FROM information_schema.applicable_roles
  1863. ----
  1864. grantee role_name is_grantable
  1865. user root
  1866. # information_schema.enabled_roles
  1867. query T colnames,rowsort
  1868. SELECT * FROM information_schema.enabled_roles
  1869. ----
  1870. role_name
  1871. admin
  1872. root
  1873. user testuser
  1874. query T colnames,rowsort
  1875. SELECT * FROM information_schema.enabled_roles
  1876. ----
  1877. role_name
  1878. testuser
  1879. user root
  1880. subtest fk_match_type
  1881. statement ok
  1882. CREATE DATABASE dfk; SET database=dfk
  1883. statement ok
  1884. CREATE TABLE v(x INT, y INT, UNIQUE (x,y))
  1885. statement ok
  1886. CREATE TABLE w(
  1887. a INT, b INT, c INT, d INT,
  1888. FOREIGN KEY (a,b) REFERENCES v(x,y) MATCH FULL,
  1889. FOREIGN KEY (c,d) REFERENCES v(x,y) MATCH SIMPLE
  1890. );
  1891. query TTTT
  1892. SELECT constraint_name, table_name, referenced_table_name, match_option
  1893. FROM information_schema.referential_constraints
  1894. ----
  1895. fk_a_ref_v w v FULL
  1896. fk_c_ref_v w v NONE
  1897. statement ok
  1898. SET database = test
  1899. statement ok
  1900. DROP DATABASE dfk CASCADE