pg_catalog.slt 104 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024
  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/pg_catalog
  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. mode cockroach
  20. # We are not currently trying to be this PostgreSQL compatible. Perhaps someday.
  21. halt
  22. statement ok
  23. SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false
  24. # Verify pg_catalog database handles mutation statements correctly.
  25. query error database "pg_catalog" does not exist
  26. ALTER DATABASE pg_catalog RENAME TO not_pg_catalog
  27. statement error schema cannot be modified: "pg_catalog"
  28. CREATE TABLE pg_catalog.t (x INT)
  29. query error database "pg_catalog" does not exist
  30. DROP DATABASE pg_catalog
  31. query T
  32. SHOW TABLES FROM pg_catalog
  33. ----
  34. pg_am
  35. pg_attrdef
  36. pg_attribute
  37. pg_auth_members
  38. pg_class
  39. pg_collation
  40. pg_constraint
  41. pg_database
  42. pg_depend
  43. pg_description
  44. pg_enum
  45. pg_extension
  46. pg_foreign_data_wrapper
  47. pg_foreign_server
  48. pg_foreign_table
  49. pg_index
  50. pg_indexes
  51. pg_inherits
  52. pg_language
  53. pg_namespace
  54. pg_operator
  55. pg_proc
  56. pg_range
  57. pg_rewrite
  58. pg_roles
  59. pg_seclabel
  60. pg_sequence
  61. pg_settings
  62. pg_shdescription
  63. pg_shseclabel
  64. pg_stat_activity
  65. pg_tables
  66. pg_tablespace
  67. pg_trigger
  68. pg_type
  69. pg_user
  70. pg_user_mapping
  71. pg_views
  72. # Verify "pg_catalog" is a regular db name
  73. statement ok
  74. CREATE DATABASE other_db
  75. statement ok
  76. ALTER DATABASE other_db RENAME TO pg_catalog
  77. statement error database "pg_catalog" already exists
  78. CREATE DATABASE pg_catalog
  79. statement ok
  80. DROP DATABASE pg_catalog
  81. # the following query checks that the planDataSource instantiated from
  82. # a virtual table in the FROM clause is properly deallocated even when
  83. # query preparation causes an error. database-issues#2980
  84. query error unknown function
  85. SELECT * FROM pg_catalog.pg_class c WHERE nonexistent_function()
  86. # Verify pg_catalog handles reflection correctly.
  87. query T
  88. SHOW TABLES FROM test.pg_catalog
  89. ----
  90. pg_am
  91. pg_attrdef
  92. pg_attribute
  93. pg_auth_members
  94. pg_class
  95. pg_collation
  96. pg_constraint
  97. pg_database
  98. pg_depend
  99. pg_description
  100. pg_enum
  101. pg_extension
  102. pg_foreign_data_wrapper
  103. pg_foreign_server
  104. pg_foreign_table
  105. pg_index
  106. pg_indexes
  107. pg_inherits
  108. pg_language
  109. pg_namespace
  110. pg_operator
  111. pg_proc
  112. pg_range
  113. pg_rewrite
  114. pg_roles
  115. pg_seclabel
  116. pg_sequence
  117. pg_settings
  118. pg_shdescription
  119. pg_shseclabel
  120. pg_stat_activity
  121. pg_tables
  122. pg_tablespace
  123. pg_trigger
  124. pg_type
  125. pg_user
  126. pg_user_mapping
  127. pg_views
  128. query TT colnames
  129. SHOW CREATE TABLE pg_catalog.pg_namespace
  130. ----
  131. table_name create_statement
  132. pg_catalog.pg_namespace CREATE TABLE pg_namespace (
  133. oid OID NULL,
  134. nspname NAME NOT NULL,
  135. nspowner OID NULL,
  136. nspacl STRING[] NULL
  137. )
  138. query TTBTTTB colnames
  139. SHOW COLUMNS FROM pg_catalog.pg_namespace
  140. ----
  141. column_name data_type is_nullable column_default generation_expression indices is_hidden
  142. oid OID true NULL · {} false
  143. nspname NAME false NULL · {} false
  144. nspowner OID true NULL · {} false
  145. nspacl STRING[] true NULL · {} false
  146. query TTBITTBB colnames
  147. SHOW INDEXES ON pg_catalog.pg_namespace
  148. ----
  149. table_name index_name non_unique seq_in_index column_name direction storing implicit
  150. query TTTTB colnames
  151. SHOW CONSTRAINTS FROM pg_catalog.pg_namespace
  152. ----
  153. table_name constraint_name constraint_type details validated
  154. query TTTTT colnames
  155. SHOW GRANTS ON pg_catalog.pg_namespace
  156. ----
  157. database_name schema_name table_name grantee privilege_type
  158. test pg_catalog pg_namespace public SELECT
  159. # Verify selecting from pg_catalog.
  160. statement ok
  161. CREATE DATABASE constraint_db
  162. statement ok
  163. CREATE TABLE constraint_db.t1 (
  164. p FLOAT PRIMARY KEY,
  165. a INT UNIQUE,
  166. b INT,
  167. c INT DEFAULT 12,
  168. d VARCHAR(5),
  169. e BIT(5),
  170. f DECIMAL(10,7),
  171. UNIQUE INDEX index_key(b, c)
  172. )
  173. statement ok
  174. CREATE TABLE constraint_db.t2 (
  175. t1_ID INT,
  176. CONSTRAINT fk FOREIGN KEY (t1_ID) REFERENCES constraint_db.t1(a),
  177. INDEX (t1_ID)
  178. )
  179. statement ok
  180. CREATE TABLE constraint_db.t3 (
  181. a INT,
  182. b INT CHECK (b > 11),
  183. c STRING DEFAULT 'FOO',
  184. CONSTRAINT fk FOREIGN KEY (a, b) REFERENCES constraint_db.t1(b, c),
  185. INDEX (a, b DESC) STORING (c)
  186. )
  187. statement ok
  188. CREATE VIEW constraint_db.v1 AS SELECT p,a,b,c FROM constraint_db.t1
  189. ## pg_catalog.pg_namespace
  190. query OTOT colnames
  191. SELECT * FROM pg_catalog.pg_namespace
  192. ----
  193. oid nspname nspowner nspacl
  194. 3604332469 crdb_internal NULL NULL
  195. 3672231114 information_schema NULL NULL
  196. 2508829085 pg_catalog NULL NULL
  197. 3426283741 public NULL NULL
  198. ## pg_catalog.pg_database
  199. query OTOITTBB colnames
  200. SELECT oid, datname, datdba, encoding, datcollate, datctype, datistemplate, datallowconn
  201. FROM pg_catalog.pg_database
  202. ORDER BY oid
  203. ----
  204. oid datname datdba encoding datcollate datctype datistemplate datallowconn
  205. 1 system NULL 6 en_US.utf8 en_US.utf8 false true
  206. 50 materialize NULL 6 en_US.utf8 en_US.utf8 false true
  207. 51 postgres NULL 6 en_US.utf8 en_US.utf8 false true
  208. 52 test NULL 6 en_US.utf8 en_US.utf8 false true
  209. 54 constraint_db NULL 6 en_US.utf8 en_US.utf8 false true
  210. query OTIOIIOT colnames
  211. SELECT oid, datname, datconnlimit, datlastsysoid, datfrozenxid, datminmxid, dattablespace, datacl
  212. FROM pg_catalog.pg_database
  213. ORDER BY oid
  214. ----
  215. oid datname datconnlimit datlastsysoid datfrozenxid datminmxid dattablespace datacl
  216. 1 system -1 NULL NULL NULL 0 NULL
  217. 50 materialize -1 NULL NULL NULL 0 NULL
  218. 51 postgres -1 NULL NULL NULL 0 NULL
  219. 52 test -1 NULL NULL NULL 0 NULL
  220. 54 constraint_db -1 NULL NULL NULL 0 NULL
  221. ## pg_catalog.pg_tables
  222. statement ok
  223. SET DATABASE = constraint_db
  224. query TTTTBBBB colnames
  225. SELECT * FROM constraint_db.pg_catalog.pg_tables WHERE schemaname = 'public'
  226. ----
  227. schemaname tablename tableowner tablespace hasindexes hasrules hastriggers rowsecurity
  228. public t1 NULL NULL true false false false
  229. public t2 NULL NULL true false false false
  230. public t3 NULL NULL true false false false
  231. query TB colnames
  232. SELECT tablename, hasindexes FROM pg_catalog.pg_tables WHERE schemaname = 'information_schema' AND tablename LIKE '%table%'
  233. ----
  234. tablename hasindexes
  235. role_table_grants false
  236. table_constraints false
  237. table_privileges false
  238. tables false
  239. ## pg_catalog.pg_tablespace
  240. query OTOTT colnames
  241. SELECT oid, spcname, spcowner, spcacl, spcoptions FROM pg_tablespace
  242. ----
  243. oid spcname spcowner spcacl spcoptions
  244. 0 pg_default NULL NULL NULL
  245. ## pg_catalog.pg_views
  246. query TTTT colnames
  247. SELECT * FROM pg_catalog.pg_views
  248. ----
  249. schemaname viewname viewowner definition
  250. public v1 NULL SELECT p, a, b, c FROM constraint_db.public.t1
  251. ## pg_catalog.pg_class
  252. query OTOOOOOO colnames
  253. SELECT c.oid, relname, relnamespace, reltype, relowner, relam, relfilenode, reltablespace
  254. FROM pg_catalog.pg_class c
  255. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  256. WHERE n.nspname = 'public'
  257. ----
  258. oid relname relnamespace reltype relowner relam relfilenode reltablespace
  259. 55 t1 2332901747 0 NULL NULL 0 0
  260. 450499963 primary 2332901747 0 NULL NULL 0 0
  261. 450499960 t1_a_key 2332901747 0 NULL NULL 0 0
  262. 450499961 index_key 2332901747 0 NULL NULL 0 0
  263. 56 t2 2332901747 0 NULL NULL 0 0
  264. 2315049508 primary 2332901747 0 NULL NULL 0 0
  265. 2315049511 t2_t1_id_idx 2332901747 0 NULL NULL 0 0
  266. 57 t3 2332901747 0 NULL NULL 0 0
  267. 969972501 primary 2332901747 0 NULL NULL 0 0
  268. 969972502 t3_a_b_idx 2332901747 0 NULL NULL 0 0
  269. 58 v1 2332901747 0 NULL NULL 0 0
  270. query TIRIOBBT colnames
  271. SELECT relname, relpages, reltuples, relallvisible, reltoastrelid, relhasindex, relisshared, relpersistence
  272. FROM pg_catalog.pg_class c
  273. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  274. WHERE n.nspname = 'public'
  275. ----
  276. relname relpages reltuples relallvisible reltoastrelid relhasindex relisshared relpersistence
  277. t1 NULL NULL 0 0 true false p
  278. primary NULL NULL 0 0 false false p
  279. t1_a_key NULL NULL 0 0 false false p
  280. index_key NULL NULL 0 0 false false p
  281. t2 NULL NULL 0 0 true false p
  282. primary NULL NULL 0 0 false false p
  283. t2_t1_id_idx NULL NULL 0 0 false false p
  284. t3 NULL NULL 0 0 true false p
  285. primary NULL NULL 0 0 false false p
  286. t3_a_b_idx NULL NULL 0 0 false false p
  287. v1 NULL NULL 0 0 false false p
  288. query TBTIIBB colnames
  289. SELECT relname, relistemp, relkind, relnatts, relchecks, relhasoids, relhaspkey
  290. FROM pg_catalog.pg_class c
  291. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  292. WHERE n.nspname = 'public'
  293. ----
  294. relname relistemp relkind relnatts relchecks relhasoids relhaspkey
  295. t1 false r 7 0 false true
  296. primary false i 1 0 false false
  297. t1_a_key false i 1 0 false false
  298. index_key false i 2 0 false false
  299. t2 false r 2 0 false true
  300. primary false i 1 0 false false
  301. t2_t1_id_idx false i 1 0 false false
  302. t3 false r 4 1 false true
  303. primary false i 1 0 false false
  304. t3_a_b_idx false i 2 0 false false
  305. v1 false v 4 0 false false
  306. query TBBBITT colnames
  307. SELECT relname, relhasrules, relhastriggers, relhassubclass, relfrozenxid, relacl, reloptions
  308. FROM pg_catalog.pg_class c
  309. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  310. WHERE n.nspname = 'public'
  311. ----
  312. relname relhasrules relhastriggers relhassubclass relfrozenxid relacl reloptions
  313. t1 false false false 0 NULL NULL
  314. primary false false false 0 NULL NULL
  315. t1_a_key false false false 0 NULL NULL
  316. index_key false false false 0 NULL NULL
  317. t2 false false false 0 NULL NULL
  318. primary false false false 0 NULL NULL
  319. t2_t1_id_idx false false false 0 NULL NULL
  320. t3 false false false 0 NULL NULL
  321. primary false false false 0 NULL NULL
  322. t3_a_b_idx false false false 0 NULL NULL
  323. v1 false false false 0 NULL NULL
  324. ## pg_catalog.pg_attribute
  325. query OTTOIIIII colnames
  326. SELECT attrelid, c.relname, attname, atttypid, attstattarget, attlen, attnum, attndims, attcacheoff
  327. FROM pg_catalog.pg_attribute a
  328. JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
  329. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  330. WHERE n.nspname = 'public'
  331. ----
  332. attrelid relname attname atttypid attstattarget attlen attnum attndims attcacheoff
  333. 55 t1 p 701 0 8 1 0 -1
  334. 55 t1 a 20 0 8 2 0 -1
  335. 55 t1 b 20 0 8 3 0 -1
  336. 55 t1 c 20 0 8 4 0 -1
  337. 55 t1 d 1043 0 -1 5 0 -1
  338. 55 t1 e 1560 0 -1 6 0 -1
  339. 55 t1 f 1700 0 -1 7 0 -1
  340. 450499963 primary p 701 0 8 1 0 -1
  341. 450499960 t1_a_key a 20 0 8 2 0 -1
  342. 450499961 index_key b 20 0 8 3 0 -1
  343. 450499961 index_key c 20 0 8 4 0 -1
  344. 56 t2 t1_id 20 0 8 1 0 -1
  345. 56 t2 rowid 20 0 8 2 0 -1
  346. 2315049508 primary rowid 20 0 8 2 0 -1
  347. 2315049511 t2_t1_id_idx t1_id 20 0 8 1 0 -1
  348. 57 t3 a 20 0 8 1 0 -1
  349. 57 t3 b 20 0 8 2 0 -1
  350. 57 t3 c 25 0 -1 3 0 -1
  351. 57 t3 rowid 20 0 8 4 0 -1
  352. 969972501 primary rowid 20 0 8 4 0 -1
  353. 969972502 t3_a_b_idx a 20 0 8 1 0 -1
  354. 969972502 t3_a_b_idx b 20 0 8 2 0 -1
  355. 58 v1 p 701 0 8 1 0 -1
  356. 58 v1 a 20 0 8 2 0 -1
  357. 58 v1 b 20 0 8 3 0 -1
  358. 58 v1 c 20 0 8 4 0 -1
  359. query TTIBTTBB colnames
  360. SELECT c.relname, attname, atttypmod, attbyval, attstorage, attalign, attnotnull, atthasdef
  361. FROM pg_catalog.pg_attribute a
  362. JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
  363. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  364. WHERE n.nspname = 'public'
  365. ----
  366. relname attname atttypmod attbyval attstorage attalign attnotnull atthasdef
  367. t1 p -1 NULL NULL NULL true false
  368. t1 a -1 NULL NULL NULL false false
  369. t1 b -1 NULL NULL NULL false false
  370. t1 c -1 NULL NULL NULL false true
  371. t1 d 9 NULL NULL NULL false false
  372. t1 e 5 NULL NULL NULL false false
  373. t1 f 655371 NULL NULL NULL false false
  374. primary p -1 NULL NULL NULL true false
  375. t1_a_key a -1 NULL NULL NULL false false
  376. index_key b -1 NULL NULL NULL false false
  377. index_key c -1 NULL NULL NULL false true
  378. t2 t1_id -1 NULL NULL NULL false false
  379. t2 rowid -1 NULL NULL NULL true true
  380. primary rowid -1 NULL NULL NULL true true
  381. t2_t1_id_idx t1_id -1 NULL NULL NULL false false
  382. t3 a -1 NULL NULL NULL false false
  383. t3 b -1 NULL NULL NULL false false
  384. t3 c -1 NULL NULL NULL false true
  385. t3 rowid -1 NULL NULL NULL true true
  386. primary rowid -1 NULL NULL NULL true true
  387. t3_a_b_idx a -1 NULL NULL NULL false false
  388. t3_a_b_idx b -1 NULL NULL NULL false false
  389. v1 p -1 NULL NULL NULL true false
  390. v1 a -1 NULL NULL NULL true false
  391. v1 b -1 NULL NULL NULL true false
  392. v1 c -1 NULL NULL NULL true false
  393. query TTBBITTT colnames
  394. SELECT c.relname, attname, attisdropped, attislocal, attinhcount, attacl, attoptions, attfdwoptions
  395. FROM pg_catalog.pg_attribute a
  396. JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
  397. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  398. WHERE n.nspname = 'public'
  399. ----
  400. relname attname attisdropped attislocal attinhcount attacl attoptions attfdwoptions
  401. t1 p false true 0 NULL NULL NULL
  402. t1 a false true 0 NULL NULL NULL
  403. t1 b false true 0 NULL NULL NULL
  404. t1 c false true 0 NULL NULL NULL
  405. t1 d false true 0 NULL NULL NULL
  406. t1 e false true 0 NULL NULL NULL
  407. t1 f false true 0 NULL NULL NULL
  408. primary p false true 0 NULL NULL NULL
  409. t1_a_key a false true 0 NULL NULL NULL
  410. index_key b false true 0 NULL NULL NULL
  411. index_key c false true 0 NULL NULL NULL
  412. t2 t1_id false true 0 NULL NULL NULL
  413. t2 rowid false true 0 NULL NULL NULL
  414. primary rowid false true 0 NULL NULL NULL
  415. t2_t1_id_idx t1_id false true 0 NULL NULL NULL
  416. t3 a false true 0 NULL NULL NULL
  417. t3 b false true 0 NULL NULL NULL
  418. t3 c false true 0 NULL NULL NULL
  419. t3 rowid false true 0 NULL NULL NULL
  420. primary rowid false true 0 NULL NULL NULL
  421. t3_a_b_idx a false true 0 NULL NULL NULL
  422. t3_a_b_idx b false true 0 NULL NULL NULL
  423. v1 p false true 0 NULL NULL NULL
  424. v1 a false true 0 NULL NULL NULL
  425. v1 b false true 0 NULL NULL NULL
  426. v1 c false true 0 NULL NULL NULL
  427. # Check relkind codes.
  428. statement ok
  429. CREATE DATABASE relkinds
  430. statement ok
  431. SET DATABASE = relkinds
  432. statement ok
  433. CREATE TABLE tbl_test (k int primary key, v int)
  434. statement ok
  435. CREATE INDEX tbl_test_v_idx ON tbl_test (v)
  436. statement ok
  437. CREATE VIEW view_test AS SELECT k, v FROM tbl_test ORDER BY v
  438. statement ok
  439. CREATE SEQUENCE seq_test
  440. query TT
  441. SELECT relname, relkind
  442. FROM pg_catalog.pg_class c
  443. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  444. WHERE n.nspname = 'public'
  445. ORDER BY relname
  446. ----
  447. primary i
  448. seq_test S
  449. tbl_test r
  450. tbl_test_v_idx i
  451. view_test v
  452. statement ok
  453. DROP DATABASE relkinds
  454. statement ok
  455. SET DATABASE = constraint_db
  456. # Select all columns with collations.
  457. query TTTOT colnames
  458. SELECT c.relname, attname, t.typname, attcollation, k.collname
  459. FROM pg_catalog.pg_attribute a
  460. JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
  461. JOIN pg_catalog.pg_type t ON a.atttypid = t.oid
  462. JOIN pg_catalog.pg_collation k ON a.attcollation = k.oid
  463. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  464. WHERE n.nspname = 'public'
  465. ----
  466. relname attname typname attcollation collname
  467. t1 d varchar 3903121477 en-US
  468. t3 c text 3903121477 en-US
  469. ## pg_catalog.pg_am
  470. query OTIIBBBBBBBBBBBOOOOOOOOOOOOOOOOOT colnames
  471. SELECT *
  472. FROM pg_catalog.pg_am
  473. ----
  474. oid amname amstrategies amsupport amcanorder amcanorderbyop amcanbackward amcanunique amcanmulticol amoptionalkey amsearcharray amsearchnulls amstorage amclusterable ampredlocks amkeytype aminsert ambeginscan amgettuple amgetbitmap amrescan amendscan ammarkpos amrestrpos ambuild ambuildempty ambulkdelete amvacuumcleanup amcanreturn amcostestimate amoptions amhandler amtype
  475. 2631952481 prefix 0 0 true false true true true true true true false false false 0 NULL NULL 0 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL i
  476. ## pg_catalog.pg_attrdef
  477. query OTOITT colnames
  478. SELECT ad.oid, c.relname, adrelid, adnum, adbin, adsrc
  479. FROM pg_catalog.pg_attrdef ad
  480. JOIN pg_catalog.pg_class c ON ad.adrelid = c.oid
  481. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  482. WHERE n.nspname = 'public'
  483. ----
  484. oid relname adrelid adnum adbin adsrc
  485. 1666782879 t1 55 4 12:::INT8 12:::INT8
  486. 841178406 t2 56 2 unique_rowid() unique_rowid()
  487. 2186255414 t3 57 3 'FOO':::STRING 'FOO':::STRING
  488. 2186255409 t3 57 4 unique_rowid() unique_rowid()
  489. ## pg_catalog.pg_indexes
  490. query OTTTT colnames
  491. SELECT crdb_oid, schemaname, tablename, indexname, tablespace
  492. FROM pg_catalog.pg_indexes
  493. WHERE schemaname = 'public'
  494. ----
  495. crdb_oid schemaname tablename indexname tablespace
  496. 450499963 public t1 primary NULL
  497. 450499960 public t1 t1_a_key NULL
  498. 450499961 public t1 index_key NULL
  499. 2315049508 public t2 primary NULL
  500. 2315049511 public t2 t2_t1_id_idx NULL
  501. 969972501 public t3 primary NULL
  502. 969972502 public t3 t3_a_b_idx NULL
  503. query OTTT colnames
  504. SELECT crdb_oid, tablename, indexname, indexdef
  505. FROM pg_catalog.pg_indexes
  506. WHERE schemaname = 'public'
  507. ----
  508. crdb_oid tablename indexname indexdef
  509. 450499963 t1 primary CREATE UNIQUE INDEX "primary" ON constraint_db.public.t1 (p ASC)
  510. 450499960 t1 t1_a_key CREATE UNIQUE INDEX t1_a_key ON constraint_db.public.t1 (a ASC)
  511. 450499961 t1 index_key CREATE UNIQUE INDEX index_key ON constraint_db.public.t1 (b ASC, c ASC)
  512. 2315049508 t2 primary CREATE UNIQUE INDEX "primary" ON constraint_db.public.t2 (rowid ASC)
  513. 2315049511 t2 t2_t1_id_idx CREATE INDEX t2_t1_id_idx ON constraint_db.public.t2 (t1_id ASC)
  514. 969972501 t3 primary CREATE UNIQUE INDEX "primary" ON constraint_db.public.t3 (rowid ASC)
  515. 969972502 t3 t3_a_b_idx CREATE INDEX t3_a_b_idx ON constraint_db.public.t3 (a ASC, b DESC) STORING (c)
  516. ## pg_catalog.pg_index
  517. query OOIBBB colnames
  518. SELECT indexrelid, indrelid, indnatts, indisunique, indisprimary, indisexclusion
  519. FROM pg_catalog.pg_index
  520. WHERE indnatts = 2
  521. ----
  522. indexrelid indrelid indnatts indisunique indisprimary indisexclusion
  523. 450499961 55 2 true false false
  524. 969972502 57 2 false false false
  525. query OBBBBB colnames
  526. SELECT indexrelid, indimmediate, indisclustered, indisvalid, indcheckxmin, indisready
  527. FROM pg_catalog.pg_index
  528. WHERE indnatts = 2
  529. ----
  530. indexrelid indimmediate indisclustered indisvalid indcheckxmin indisready
  531. 450499961 true false true false false
  532. 969972502 false false true false false
  533. query OOBBTTTTTT colnames
  534. SELECT indexrelid, indrelid, indislive, indisreplident, indkey, indcollation, indclass, indoption, indexprs, indpred
  535. FROM pg_catalog.pg_index
  536. WHERE indnatts = 2
  537. ----
  538. indexrelid indrelid indislive indisreplident indkey indcollation indclass indoption indexprs indpred
  539. 450499961 55 true false 3 4 0 0 0 0 0 0 NULL NULL
  540. 969972502 57 true false 1 2 0 0 0 0 0 0 NULL NULL
  541. statement ok
  542. SET DATABASE = system
  543. query OOIBBBBBBBBBBTTTTTT colnames
  544. SELECT *
  545. FROM pg_catalog.pg_index
  546. ORDER BY indexrelid
  547. ----
  548. indexrelid indrelid indnatts indisunique indisprimary indisexclusion indimmediate indisclustered indisvalid indcheckxmin indisready indislive indisreplident indkey indcollation indclass indoption indexprs indpred
  549. 543291288 23 1 false false false false false true false false true false 1 3903121477 0 0 NULL NULL
  550. 543291289 23 1 false false false false false true false false true false 2 3903121477 0 0 NULL NULL
  551. 543291291 23 2 true true false true false true false false true false 1 2 3903121477 3903121477 0 0 0 0 NULL NULL
  552. 1276104432 12 2 true true false true false true false false true false 1 6 0 0 0 0 0 0 NULL NULL
  553. 1582236367 3 1 true true false true false true false false true false 1 0 0 0 NULL NULL
  554. 1628632028 19 1 false false false false false true false false true false 5 0 0 0 NULL NULL
  555. 1628632029 19 1 false false false false false true false false true false 4 0 0 0 NULL NULL
  556. 1628632031 19 1 true true false true false true false false true false 1 0 0 0 NULL NULL
  557. 1841972634 6 1 true true false true false true false false true false 1 3903121477 0 0 NULL NULL
  558. 2101708905 5 1 true true false true false true false false true false 1 0 0 0 NULL NULL
  559. 2148104569 21 2 true true false true false true false false true false 1 2 3903121477 3903121477 0 0 0 0 NULL NULL
  560. 2407840836 24 3 true true false true false true false false true false 1 2 3 0 0 0 0 0 0 0 0 0 NULL NULL
  561. 2621181440 15 2 false false false false false true false false true false 2 3 3903121477 0 0 0 0 0 NULL NULL
  562. 2621181443 15 1 true true false true false true false false true false 1 0 0 0 NULL NULL
  563. 2927313374 2 2 true true false true false true false false true false 1 2 0 3903121477 0 0 0 0 NULL NULL
  564. 3446785912 4 1 true true false true false true false false true false 1 3903121477 0 0 NULL NULL
  565. 3493181576 20 2 true true false true false true false false true false 1 2 0 0 0 0 0 0 NULL NULL
  566. 3706522183 11 4 true true false true false true false false true false 1 2 4 3 0 0 0 0 0 0 0 0 0 0 0 0 NULL NULL
  567. 3966258450 14 1 true true false true false true false false true false 1 3903121477 0 0 NULL NULL
  568. 4225994721 13 2 true true false true false true false false true false 1 7 0 0 0 0 0 0 NULL NULL
  569. # From materialize#26504
  570. query OOI colnames
  571. SELECT indexrelid,
  572. (information_schema._pg_expandarray(indclass)).x AS operator_argument_type_oid,
  573. (information_schema._pg_expandarray(indclass)).n AS operator_argument_position
  574. FROM pg_index
  575. ORDER BY indexrelid, operator_argument_position
  576. ----
  577. indexrelid operator_argument_type_oid operator_argument_position
  578. 543291288 0 1
  579. 543291289 0 1
  580. 543291291 0 1
  581. 543291291 0 2
  582. 1276104432 0 1
  583. 1276104432 0 2
  584. 1582236367 0 1
  585. 1628632028 0 1
  586. 1628632029 0 1
  587. 1628632031 0 1
  588. 1841972634 0 1
  589. 2101708905 0 1
  590. 2148104569 0 1
  591. 2148104569 0 2
  592. 2407840836 0 1
  593. 2407840836 0 2
  594. 2407840836 0 3
  595. 2621181440 0 1
  596. 2621181440 0 2
  597. 2621181443 0 1
  598. 2927313374 0 1
  599. 2927313374 0 2
  600. 3446785912 0 1
  601. 3493181576 0 1
  602. 3493181576 0 2
  603. 3706522183 0 1
  604. 3706522183 0 2
  605. 3706522183 0 3
  606. 3706522183 0 4
  607. 3966258450 0 1
  608. 4225994721 0 1
  609. 4225994721 0 2
  610. ## pg_catalog.pg_collation
  611. statement ok
  612. SET DATABASE = constraint_db
  613. query OTOOITT colnames
  614. SELECT * FROM pg_collation
  615. WHERE collname='en-US'
  616. ----
  617. oid collname collnamespace collowner collencoding collcollate collctype
  618. 3903121477 en-US 2332901747 NULL 6 NULL NULL
  619. ## pg_catalog.pg_constraint
  620. ##
  621. ## These order of this virtual table is non-deterministic, so all queries must
  622. ## explicitly add an ORDER BY clause.
  623. query OTOT colnames
  624. SELECT con.oid, conname, connamespace, contype
  625. FROM pg_catalog.pg_constraint con
  626. JOIN pg_catalog.pg_namespace n ON con.connamespace = n.oid
  627. WHERE n.nspname = 'public'
  628. ORDER BY con.oid
  629. ----
  630. oid conname connamespace contype
  631. 178791267 fk 2332901747 f
  632. 3236224800 check_b 2332901747 c
  633. 3318155331 fk 2332901747 f
  634. 3572320190 primary 2332901747 p
  635. 4243354484 t1_a_key 2332901747 u
  636. 4243354485 index_key 2332901747 u
  637. query TTBBBOOO colnames
  638. SELECT conname, contype, condeferrable, condeferred, convalidated, conrelid, contypid, conindid
  639. FROM pg_catalog.pg_constraint con
  640. JOIN pg_catalog.pg_namespace n ON con.connamespace = n.oid
  641. WHERE n.nspname = 'public'
  642. ORDER BY con.oid
  643. ----
  644. conname contype condeferrable condeferred convalidated conrelid contypid conindid
  645. fk f false false true 57 0 450499961
  646. check_b c false false true 57 0 0
  647. fk f false false true 56 0 450499960
  648. primary p false false true 55 0 450499963
  649. t1_a_key u false false true 55 0 450499960
  650. index_key u false false true 55 0 450499961
  651. query T
  652. SELECT conname
  653. FROM pg_catalog.pg_constraint con
  654. JOIN pg_catalog.pg_namespace n ON con.connamespace = n.oid
  655. WHERE n.nspname = 'public' AND contype NOT IN ('c', 'f', 'p', 'u')
  656. ORDER BY con.oid
  657. ----
  658. query TOTTT colnames
  659. SELECT conname, confrelid, confupdtype, confdeltype, confmatchtype
  660. FROM pg_catalog.pg_constraint con
  661. JOIN pg_catalog.pg_namespace n ON con.connamespace = n.oid
  662. WHERE n.nspname = 'public' AND contype IN ('c', 'p', 'u')
  663. ORDER BY con.oid
  664. ----
  665. conname confrelid confupdtype confdeltype confmatchtype
  666. check_b 0 NULL NULL NULL
  667. primary 0 NULL NULL NULL
  668. t1_a_key 0 NULL NULL NULL
  669. index_key 0 NULL NULL NULL
  670. query TOTTT colnames
  671. SELECT conname, confrelid, confupdtype, confdeltype, confmatchtype
  672. FROM pg_catalog.pg_constraint con
  673. JOIN pg_catalog.pg_namespace n ON con.connamespace = n.oid
  674. WHERE n.nspname = 'public' AND contype = 'f'
  675. ORDER BY con.oid
  676. ----
  677. conname confrelid confupdtype confdeltype confmatchtype
  678. fk 55 a a s
  679. fk 55 a a s
  680. query TBIBT colnames
  681. SELECT conname, conislocal, coninhcount, connoinherit, conkey
  682. FROM pg_catalog.pg_constraint con
  683. JOIN pg_catalog.pg_namespace n ON con.connamespace = n.oid
  684. WHERE n.nspname = 'public'
  685. ORDER BY con.oid
  686. ----
  687. conname conislocal coninhcount connoinherit conkey
  688. fk true 0 true {1,2}
  689. check_b true 0 true {2}
  690. fk true 0 true {1}
  691. primary true 0 true {1}
  692. t1_a_key true 0 true {2}
  693. index_key true 0 true {3,4}
  694. query TTTTTTTT colnames
  695. SELECT conname, confkey, conpfeqop, conppeqop, conffeqop, conexclop, conbin, consrc
  696. FROM pg_catalog.pg_constraint con
  697. JOIN pg_catalog.pg_namespace n ON con.connamespace = n.oid
  698. WHERE n.nspname = 'public' AND contype IN ('c', 'p', 'u')
  699. ORDER BY con.oid
  700. ----
  701. conname confkey conpfeqop conppeqop conffeqop conexclop conbin consrc
  702. check_b NULL NULL NULL NULL NULL b > 11 b > 11
  703. primary NULL NULL NULL NULL NULL NULL NULL
  704. t1_a_key NULL NULL NULL NULL NULL NULL NULL
  705. index_key NULL NULL NULL NULL NULL NULL NULL
  706. query TTTTTTTT colnames
  707. SELECT conname, confkey, conpfeqop, conppeqop, conffeqop, conexclop, conbin, consrc
  708. FROM pg_catalog.pg_constraint con
  709. JOIN pg_catalog.pg_namespace n ON con.connamespace = n.oid
  710. WHERE n.nspname = 'public' AND contype = 'f'
  711. ORDER BY con.oid
  712. ----
  713. conname confkey conpfeqop conppeqop conffeqop conexclop conbin consrc
  714. fk {3,4} NULL NULL NULL NULL NULL NULL
  715. fk {2} NULL NULL NULL NULL NULL NULL
  716. ## pg_catalog.pg_depend
  717. query OOIOOIT colnames
  718. SELECT classid, objid, objsubid, refclassid, refobjid, refobjsubid, deptype
  719. FROM pg_catalog.pg_depend
  720. ORDER BY objid
  721. ----
  722. classid objid objsubid refclassid refobjid refobjsubid deptype
  723. 4294967232 178791267 0 4294967234 450499961 0 n
  724. 4294967232 3318155331 0 4294967234 450499960 0 n
  725. # All entries in pg_depend are dependency links from the pg_constraint system
  726. # table to the pg_class system table.
  727. query OOTT colnames
  728. SELECT DISTINCT classid, refclassid, cla.relname AS tablename, refcla.relname AS reftablename
  729. FROM pg_catalog.pg_depend
  730. JOIN pg_class cla ON classid=cla.oid
  731. JOIN pg_class refcla ON refclassid=refcla.oid
  732. ----
  733. classid refclassid tablename reftablename
  734. 4294967232 4294967234 pg_constraint pg_class
  735. # All entries in pg_depend are foreign key constraints that reference an index
  736. # in pg_class.
  737. query TT colnames
  738. SELECT relname, relkind
  739. FROM pg_depend
  740. JOIN pg_class ON refobjid=pg_class.oid
  741. ORDER BY relname
  742. ----
  743. relname relkind
  744. index_key i
  745. t1_a_key i
  746. # All entries are pg_depend are linked to a foreign key constraint whose
  747. # supporting index is the referenced object id.
  748. query T colnames
  749. SELECT DISTINCT pg_constraint.contype
  750. FROM pg_depend
  751. JOIN pg_constraint ON objid=pg_constraint.oid AND refobjid=pg_constraint.conindid
  752. ----
  753. contype
  754. f
  755. ## pg_catalog.pg_type
  756. query OTOOIBT colnames
  757. SELECT oid, typname, typnamespace, typowner, typlen, typbyval, typtype
  758. FROM pg_catalog.pg_type
  759. ORDER BY oid
  760. ----
  761. oid typname typnamespace typowner typlen typbyval typtype
  762. 16 bool 1307062959 NULL 1 true b
  763. 17 bytea 1307062959 NULL -1 false b
  764. 18 char 1307062959 NULL -1 false b
  765. 19 name 1307062959 NULL -1 false b
  766. 20 int8 1307062959 NULL 8 true b
  767. 21 int2 1307062959 NULL 8 true b
  768. 22 int2vector 1307062959 NULL -1 false b
  769. 23 int4 1307062959 NULL 8 true b
  770. 24 regproc 1307062959 NULL 8 true b
  771. 25 text 1307062959 NULL -1 false b
  772. 26 oid 1307062959 NULL 8 true b
  773. 30 oidvector 1307062959 NULL -1 false b
  774. 700 float4 1307062959 NULL 8 true b
  775. 701 float8 1307062959 NULL 8 true b
  776. 705 unknown 1307062959 NULL 0 true b
  777. 869 inet 1307062959 NULL 24 true b
  778. 1000 _bool 1307062959 NULL -1 false b
  779. 1001 _bytea 1307062959 NULL -1 false b
  780. 1002 _char 1307062959 NULL -1 false b
  781. 1003 _name 1307062959 NULL -1 false b
  782. 1005 _int2 1307062959 NULL -1 false b
  783. 1006 _int2vector 1307062959 NULL -1 false b
  784. 1007 _int4 1307062959 NULL -1 false b
  785. 1008 _regproc 1307062959 NULL -1 false b
  786. 1009 _text 1307062959 NULL -1 false b
  787. 1013 _oidvector 1307062959 NULL -1 false b
  788. 1014 _bpchar 1307062959 NULL -1 false b
  789. 1015 _varchar 1307062959 NULL -1 false b
  790. 1016 _int8 1307062959 NULL -1 false b
  791. 1021 _float4 1307062959 NULL -1 false b
  792. 1022 _float8 1307062959 NULL -1 false b
  793. 1028 _oid 1307062959 NULL -1 false b
  794. 1041 _inet 1307062959 NULL -1 false b
  795. 1042 bpchar 1307062959 NULL -1 false b
  796. 1043 varchar 1307062959 NULL -1 false b
  797. 1082 date 1307062959 NULL 16 true b
  798. 1083 time 1307062959 NULL 8 true b
  799. 1114 timestamp 1307062959 NULL 24 true b
  800. 1115 _timestamp 1307062959 NULL -1 false b
  801. 1182 _date 1307062959 NULL -1 false b
  802. 1183 _time 1307062959 NULL -1 false b
  803. 1184 timestamptz 1307062959 NULL 24 true b
  804. 1185 _timestamptz 1307062959 NULL -1 false b
  805. 1186 interval 1307062959 NULL 24 true b
  806. 1187 _interval 1307062959 NULL -1 false b
  807. 1231 _numeric 1307062959 NULL -1 false b
  808. 1560 bit 1307062959 NULL -1 false b
  809. 1561 _bit 1307062959 NULL -1 false b
  810. 1562 varbit 1307062959 NULL -1 false b
  811. 1563 _varbit 1307062959 NULL -1 false b
  812. 1700 numeric 1307062959 NULL -1 false b
  813. 2202 regprocedure 1307062959 NULL 8 true b
  814. 2205 regclass 1307062959 NULL 8 true b
  815. 2206 regtype 1307062959 NULL 8 true b
  816. 2207 _regprocedure 1307062959 NULL -1 false b
  817. 2210 _regclass 1307062959 NULL -1 false b
  818. 2211 _regtype 1307062959 NULL -1 false b
  819. 2249 record 1307062959 NULL 0 true p
  820. 2277 anyarray 1307062959 NULL -1 false p
  821. 2283 anyelement 1307062959 NULL -1 false p
  822. 2287 _record 1307062959 NULL -1 false b
  823. 2950 uuid 1307062959 NULL 16 true b
  824. 2951 _uuid 1307062959 NULL -1 false b
  825. 3802 jsonb 1307062959 NULL -1 false b
  826. 3807 _jsonb 1307062959 NULL -1 false b
  827. 4089 regnamespace 1307062959 NULL 8 true b
  828. 4090 _regnamespace 1307062959 NULL -1 false b
  829. query OTTBBTOOO colnames
  830. SELECT oid, typname, typcategory, typispreferred, typisdefined, typdelim, typrelid, typelem, typarray
  831. FROM pg_catalog.pg_type
  832. ORDER BY oid
  833. ----
  834. oid typname typcategory typispreferred typisdefined typdelim typrelid typelem typarray
  835. 16 bool B false true , 0 0 1000
  836. 17 bytea U false true , 0 0 1001
  837. 18 char S false true , 0 0 1002
  838. 19 name S false true , 0 0 1003
  839. 20 int8 N false true , 0 0 1016
  840. 21 int2 N false true , 0 0 1005
  841. 22 int2vector A false true , 0 21 1006
  842. 23 int4 N false true , 0 0 1007
  843. 24 regproc N false true , 0 0 1008
  844. 25 text S false true , 0 0 1009
  845. 26 oid N false true , 0 0 1028
  846. 30 oidvector A false true , 0 26 1013
  847. 700 float4 N false true , 0 0 1021
  848. 701 float8 N false true , 0 0 1022
  849. 705 unknown X false true , 0 0 0
  850. 869 inet I false true , 0 0 1041
  851. 1000 _bool A false true , 0 16 0
  852. 1001 _bytea A false true , 0 17 0
  853. 1002 _char A false true , 0 18 0
  854. 1003 _name A false true , 0 19 0
  855. 1005 _int2 A false true , 0 21 0
  856. 1006 _int2vector A false true , 0 22 0
  857. 1007 _int4 A false true , 0 23 0
  858. 1008 _regproc A false true , 0 24 0
  859. 1009 _text A false true , 0 25 0
  860. 1013 _oidvector A false true , 0 30 0
  861. 1014 _bpchar A false true , 0 1042 0
  862. 1015 _varchar A false true , 0 1043 0
  863. 1016 _int8 A false true , 0 20 0
  864. 1021 _float4 A false true , 0 700 0
  865. 1022 _float8 A false true , 0 701 0
  866. 1028 _oid A false true , 0 26 0
  867. 1041 _inet A false true , 0 869 0
  868. 1042 bpchar S false true , 0 0 1014
  869. 1043 varchar S false true , 0 0 1015
  870. 1082 date D false true , 0 0 1182
  871. 1083 time D false true , 0 0 1183
  872. 1114 timestamp D false true , 0 0 1115
  873. 1115 _timestamp A false true , 0 1114 0
  874. 1182 _date A false true , 0 1082 0
  875. 1183 _time A false true , 0 1083 0
  876. 1184 timestamptz D false true , 0 0 1185
  877. 1185 _timestamptz A false true , 0 1184 0
  878. 1186 interval T false true , 0 0 1187
  879. 1187 _interval A false true , 0 1186 0
  880. 1231 _numeric A false true , 0 1700 0
  881. 1560 bit V false true , 0 0 1561
  882. 1561 _bit A false true , 0 1560 0
  883. 1562 varbit V false true , 0 0 1563
  884. 1563 _varbit A false true , 0 1562 0
  885. 1700 numeric N false true , 0 0 1231
  886. 2202 regprocedure N false true , 0 0 2207
  887. 2205 regclass N false true , 0 0 2210
  888. 2206 regtype N false true , 0 0 2211
  889. 2207 _regprocedure A false true , 0 2202 0
  890. 2210 _regclass A false true , 0 2205 0
  891. 2211 _regtype A false true , 0 2206 0
  892. 2249 record P false true , 0 0 2287
  893. 2277 anyarray P false true , 0 0 0
  894. 2283 anyelement P false true , 0 0 2277
  895. 2287 _record A false true , 0 2249 0
  896. 2950 uuid U false true , 0 0 2951
  897. 2951 _uuid A false true , 0 2950 0
  898. 3802 jsonb U false true , 0 0 3807
  899. 3807 _jsonb A false true , 0 3802 0
  900. 4089 regnamespace N false true , 0 0 4090
  901. 4090 _regnamespace A false true , 0 4089 0
  902. query OTOOOOOOO colnames
  903. SELECT oid, typname, typinput, typoutput, typreceive, typsend, typmodin, typmodout, typanalyze
  904. FROM pg_catalog.pg_type
  905. ORDER BY oid
  906. ----
  907. oid typname typinput typoutput typreceive typsend typmodin typmodout typanalyze
  908. 16 bool boolin boolout boolrecv boolsend 0 0 0
  909. 17 bytea byteain byteaout bytearecv byteasend 0 0 0
  910. 18 char charin charout charrecv charsend 0 0 0
  911. 19 name namein nameout namerecv namesend 0 0 0
  912. 20 int8 int8in int8out int8recv int8send 0 0 0
  913. 21 int2 int2in int2out int2recv int2send 0 0 0
  914. 22 int2vector int2vectorin int2vectorout int2vectorrecv int2vectorsend 0 0 0
  915. 23 int4 int4in int4out int4recv int4send 0 0 0
  916. 24 regproc regprocin regprocout regprocrecv regprocsend 0 0 0
  917. 25 text textin textout textrecv textsend 0 0 0
  918. 26 oid oidin oidout oidrecv oidsend 0 0 0
  919. 30 oidvector oidvectorin oidvectorout oidvectorrecv oidvectorsend 0 0 0
  920. 700 float4 float4in float4out float4recv float4send 0 0 0
  921. 701 float8 float8in float8out float8recv float8send 0 0 0
  922. 705 unknown unknownin unknownout unknownrecv unknownsend 0 0 0
  923. 869 inet inetin inetout inetrecv inetsend 0 0 0
  924. 1000 _bool array_in array_out array_recv array_send 0 0 0
  925. 1001 _bytea array_in array_out array_recv array_send 0 0 0
  926. 1002 _char array_in array_out array_recv array_send 0 0 0
  927. 1003 _name array_in array_out array_recv array_send 0 0 0
  928. 1005 _int2 array_in array_out array_recv array_send 0 0 0
  929. 1006 _int2vector array_in array_out array_recv array_send 0 0 0
  930. 1007 _int4 array_in array_out array_recv array_send 0 0 0
  931. 1008 _regproc array_in array_out array_recv array_send 0 0 0
  932. 1009 _text array_in array_out array_recv array_send 0 0 0
  933. 1013 _oidvector array_in array_out array_recv array_send 0 0 0
  934. 1014 _bpchar array_in array_out array_recv array_send 0 0 0
  935. 1015 _varchar array_in array_out array_recv array_send 0 0 0
  936. 1016 _int8 array_in array_out array_recv array_send 0 0 0
  937. 1021 _float4 array_in array_out array_recv array_send 0 0 0
  938. 1022 _float8 array_in array_out array_recv array_send 0 0 0
  939. 1028 _oid array_in array_out array_recv array_send 0 0 0
  940. 1041 _inet array_in array_out array_recv array_send 0 0 0
  941. 1042 bpchar bpcharin bpcharout bpcharrecv bpcharsend 0 0 0
  942. 1043 varchar varcharin varcharout varcharrecv varcharsend 0 0 0
  943. 1082 date date_in date_out date_recv date_send 0 0 0
  944. 1083 time time_in time_out time_recv time_send 0 0 0
  945. 1114 timestamp timestamp_in timestamp_out timestamp_recv timestamp_send 0 0 0
  946. 1115 _timestamp array_in array_out array_recv array_send 0 0 0
  947. 1182 _date array_in array_out array_recv array_send 0 0 0
  948. 1183 _time array_in array_out array_recv array_send 0 0 0
  949. 1184 timestamptz timestamptz_in timestamptz_out timestamptz_recv timestamptz_send 0 0 0
  950. 1185 _timestamptz array_in array_out array_recv array_send 0 0 0
  951. 1186 interval interval_in interval_out interval_recv interval_send 0 0 0
  952. 1187 _interval array_in array_out array_recv array_send 0 0 0
  953. 1231 _numeric array_in array_out array_recv array_send 0 0 0
  954. 1560 bit bit_in bit_out bit_recv bit_send 0 0 0
  955. 1561 _bit array_in array_out array_recv array_send 0 0 0
  956. 1562 varbit varbit_in varbit_out varbit_recv varbit_send 0 0 0
  957. 1563 _varbit array_in array_out array_recv array_send 0 0 0
  958. 1700 numeric numeric_in numeric_out numeric_recv numeric_send 0 0 0
  959. 2202 regprocedure regprocedurein regprocedureout regprocedurerecv regproceduresend 0 0 0
  960. 2205 regclass regclassin regclassout regclassrecv regclasssend 0 0 0
  961. 2206 regtype regtypein regtypeout regtyperecv regtypesend 0 0 0
  962. 2207 _regprocedure array_in array_out array_recv array_send 0 0 0
  963. 2210 _regclass array_in array_out array_recv array_send 0 0 0
  964. 2211 _regtype array_in array_out array_recv array_send 0 0 0
  965. 2249 record record_in record_out record_recv record_send 0 0 0
  966. 2277 anyarray anyarray_in anyarray_out anyarray_recv anyarray_send 0 0 0
  967. 2283 anyelement anyelement_in anyelement_out anyelement_recv anyelement_send 0 0 0
  968. 2287 _record array_in array_out array_recv array_send 0 0 0
  969. 2950 uuid uuid_in uuid_out uuid_recv uuid_send 0 0 0
  970. 2951 _uuid array_in array_out array_recv array_send 0 0 0
  971. 3802 jsonb jsonb_in jsonb_out jsonb_recv jsonb_send 0 0 0
  972. 3807 _jsonb array_in array_out array_recv array_send 0 0 0
  973. 4089 regnamespace regnamespacein regnamespaceout regnamespacerecv regnamespacesend 0 0 0
  974. 4090 _regnamespace array_in array_out array_recv array_send 0 0 0
  975. query OTTTBOI colnames
  976. SELECT oid, typname, typalign, typstorage, typnotnull, typbasetype, typtypmod
  977. FROM pg_catalog.pg_type
  978. ORDER BY oid
  979. ----
  980. oid typname typalign typstorage typnotnull typbasetype typtypmod
  981. 16 bool NULL NULL false 0 -1
  982. 17 bytea NULL NULL false 0 -1
  983. 18 char NULL NULL false 0 -1
  984. 19 name NULL NULL false 0 -1
  985. 20 int8 NULL NULL false 0 -1
  986. 21 int2 NULL NULL false 0 -1
  987. 22 int2vector NULL NULL false 0 -1
  988. 23 int4 NULL NULL false 0 -1
  989. 24 regproc NULL NULL false 0 -1
  990. 25 text NULL NULL false 0 -1
  991. 26 oid NULL NULL false 0 -1
  992. 30 oidvector NULL NULL false 0 -1
  993. 700 float4 NULL NULL false 0 -1
  994. 701 float8 NULL NULL false 0 -1
  995. 705 unknown NULL NULL false 0 -1
  996. 869 inet NULL NULL false 0 -1
  997. 1000 _bool NULL NULL false 0 -1
  998. 1001 _bytea NULL NULL false 0 -1
  999. 1002 _char NULL NULL false 0 -1
  1000. 1003 _name NULL NULL false 0 -1
  1001. 1005 _int2 NULL NULL false 0 -1
  1002. 1006 _int2vector NULL NULL false 0 -1
  1003. 1007 _int4 NULL NULL false 0 -1
  1004. 1008 _regproc NULL NULL false 0 -1
  1005. 1009 _text NULL NULL false 0 -1
  1006. 1013 _oidvector NULL NULL false 0 -1
  1007. 1014 _bpchar NULL NULL false 0 -1
  1008. 1015 _varchar NULL NULL false 0 -1
  1009. 1016 _int8 NULL NULL false 0 -1
  1010. 1021 _float4 NULL NULL false 0 -1
  1011. 1022 _float8 NULL NULL false 0 -1
  1012. 1028 _oid NULL NULL false 0 -1
  1013. 1041 _inet NULL NULL false 0 -1
  1014. 1042 bpchar NULL NULL false 0 -1
  1015. 1043 varchar NULL NULL false 0 -1
  1016. 1082 date NULL NULL false 0 -1
  1017. 1083 time NULL NULL false 0 -1
  1018. 1114 timestamp NULL NULL false 0 -1
  1019. 1115 _timestamp NULL NULL false 0 -1
  1020. 1182 _date NULL NULL false 0 -1
  1021. 1183 _time NULL NULL false 0 -1
  1022. 1184 timestamptz NULL NULL false 0 -1
  1023. 1185 _timestamptz NULL NULL false 0 -1
  1024. 1186 interval NULL NULL false 0 -1
  1025. 1187 _interval NULL NULL false 0 -1
  1026. 1231 _numeric NULL NULL false 0 -1
  1027. 1560 bit NULL NULL false 0 -1
  1028. 1561 _bit NULL NULL false 0 -1
  1029. 1562 varbit NULL NULL false 0 -1
  1030. 1563 _varbit NULL NULL false 0 -1
  1031. 1700 numeric NULL NULL false 0 -1
  1032. 2202 regprocedure NULL NULL false 0 -1
  1033. 2205 regclass NULL NULL false 0 -1
  1034. 2206 regtype NULL NULL false 0 -1
  1035. 2207 _regprocedure NULL NULL false 0 -1
  1036. 2210 _regclass NULL NULL false 0 -1
  1037. 2211 _regtype NULL NULL false 0 -1
  1038. 2249 record NULL NULL false 0 -1
  1039. 2277 anyarray NULL NULL false 0 -1
  1040. 2283 anyelement NULL NULL false 0 -1
  1041. 2287 _record NULL NULL false 0 -1
  1042. 2950 uuid NULL NULL false 0 -1
  1043. 2951 _uuid NULL NULL false 0 -1
  1044. 3802 jsonb NULL NULL false 0 -1
  1045. 3807 _jsonb NULL NULL false 0 -1
  1046. 4089 regnamespace NULL NULL false 0 -1
  1047. 4090 _regnamespace NULL NULL false 0 -1
  1048. query OTIOTTT colnames
  1049. SELECT oid, typname, typndims, typcollation, typdefaultbin, typdefault, typacl
  1050. FROM pg_catalog.pg_type
  1051. ORDER BY oid
  1052. ----
  1053. oid typname typndims typcollation typdefaultbin typdefault typacl
  1054. 16 bool 0 0 NULL NULL NULL
  1055. 17 bytea 0 0 NULL NULL NULL
  1056. 18 char 0 3903121477 NULL NULL NULL
  1057. 19 name 0 3903121477 NULL NULL NULL
  1058. 20 int8 0 0 NULL NULL NULL
  1059. 21 int2 0 0 NULL NULL NULL
  1060. 22 int2vector 0 0 NULL NULL NULL
  1061. 23 int4 0 0 NULL NULL NULL
  1062. 24 regproc 0 0 NULL NULL NULL
  1063. 25 text 0 3903121477 NULL NULL NULL
  1064. 26 oid 0 0 NULL NULL NULL
  1065. 30 oidvector 0 0 NULL NULL NULL
  1066. 700 float4 0 0 NULL NULL NULL
  1067. 701 float8 0 0 NULL NULL NULL
  1068. 705 unknown 0 0 NULL NULL NULL
  1069. 869 inet 0 0 NULL NULL NULL
  1070. 1000 _bool 0 0 NULL NULL NULL
  1071. 1001 _bytea 0 0 NULL NULL NULL
  1072. 1002 _char 0 3903121477 NULL NULL NULL
  1073. 1003 _name 0 3903121477 NULL NULL NULL
  1074. 1005 _int2 0 0 NULL NULL NULL
  1075. 1006 _int2vector 0 0 NULL NULL NULL
  1076. 1007 _int4 0 0 NULL NULL NULL
  1077. 1008 _regproc 0 0 NULL NULL NULL
  1078. 1009 _text 0 3903121477 NULL NULL NULL
  1079. 1013 _oidvector 0 0 NULL NULL NULL
  1080. 1014 _bpchar 0 3903121477 NULL NULL NULL
  1081. 1015 _varchar 0 3903121477 NULL NULL NULL
  1082. 1016 _int8 0 0 NULL NULL NULL
  1083. 1021 _float4 0 0 NULL NULL NULL
  1084. 1022 _float8 0 0 NULL NULL NULL
  1085. 1028 _oid 0 0 NULL NULL NULL
  1086. 1041 _inet 0 0 NULL NULL NULL
  1087. 1042 bpchar 0 3903121477 NULL NULL NULL
  1088. 1043 varchar 0 3903121477 NULL NULL NULL
  1089. 1082 date 0 0 NULL NULL NULL
  1090. 1083 time 0 0 NULL NULL NULL
  1091. 1114 timestamp 0 0 NULL NULL NULL
  1092. 1115 _timestamp 0 0 NULL NULL NULL
  1093. 1182 _date 0 0 NULL NULL NULL
  1094. 1183 _time 0 0 NULL NULL NULL
  1095. 1184 timestamptz 0 0 NULL NULL NULL
  1096. 1185 _timestamptz 0 0 NULL NULL NULL
  1097. 1186 interval 0 0 NULL NULL NULL
  1098. 1187 _interval 0 0 NULL NULL NULL
  1099. 1231 _numeric 0 0 NULL NULL NULL
  1100. 1560 bit 0 0 NULL NULL NULL
  1101. 1561 _bit 0 0 NULL NULL NULL
  1102. 1562 varbit 0 0 NULL NULL NULL
  1103. 1563 _varbit 0 0 NULL NULL NULL
  1104. 1700 numeric 0 0 NULL NULL NULL
  1105. 2202 regprocedure 0 0 NULL NULL NULL
  1106. 2205 regclass 0 0 NULL NULL NULL
  1107. 2206 regtype 0 0 NULL NULL NULL
  1108. 2207 _regprocedure 0 0 NULL NULL NULL
  1109. 2210 _regclass 0 0 NULL NULL NULL
  1110. 2211 _regtype 0 0 NULL NULL NULL
  1111. 2249 record 0 0 NULL NULL NULL
  1112. 2277 anyarray 0 3903121477 NULL NULL NULL
  1113. 2283 anyelement 0 0 NULL NULL NULL
  1114. 2287 _record 0 0 NULL NULL NULL
  1115. 2950 uuid 0 0 NULL NULL NULL
  1116. 2951 _uuid 0 0 NULL NULL NULL
  1117. 3802 jsonb 0 0 NULL NULL NULL
  1118. 3807 _jsonb 0 0 NULL NULL NULL
  1119. 4089 regnamespace 0 0 NULL NULL NULL
  1120. 4090 _regnamespace 0 0 NULL NULL NULL
  1121. ## pg_catalog.pg_proc
  1122. query TOOOTTO colnames
  1123. SELECT proname, pronamespace, proowner, prolang, procost, prorows, provariadic
  1124. FROM pg_catalog.pg_proc
  1125. WHERE proname='substring'
  1126. ----
  1127. proname pronamespace proowner prolang procost prorows provariadic
  1128. substring 1307062959 NULL 0 NULL NULL 0
  1129. substring 1307062959 NULL 0 NULL NULL 0
  1130. substring 1307062959 NULL 0 NULL NULL 0
  1131. substring 1307062959 NULL 0 NULL NULL 0
  1132. query TTBBBB colnames
  1133. SELECT proname, protransform, proisagg, proiswindow, prosecdef, proleakproof
  1134. FROM pg_catalog.pg_proc
  1135. WHERE proname='substring'
  1136. ----
  1137. proname protransform proisagg proiswindow prosecdef proleakproof
  1138. substring NULL false false false true
  1139. substring NULL false false false true
  1140. substring NULL false false false true
  1141. substring NULL false false false true
  1142. query TBBTT colnames
  1143. SELECT proname, proisstrict, proretset, provolatile, proparallel
  1144. FROM pg_catalog.pg_proc
  1145. WHERE proname='substring'
  1146. ----
  1147. proname proisstrict proretset provolatile proparallel
  1148. substring false false NULL NULL
  1149. substring false false NULL NULL
  1150. substring false false NULL NULL
  1151. substring false false NULL NULL
  1152. query TIIOTTTT colnames
  1153. SELECT proname, pronargs, pronargdefaults, prorettype, proargtypes, proallargtypes, proargmodes, proargdefaults
  1154. FROM pg_catalog.pg_proc
  1155. WHERE proname='substring'
  1156. ----
  1157. proname pronargs pronargdefaults prorettype proargtypes proallargtypes proargmodes proargdefaults
  1158. substring 2 0 25 25 20 NULL NULL NULL
  1159. substring 3 0 25 25 20 20 NULL NULL NULL
  1160. substring 2 0 25 25 25 NULL NULL NULL
  1161. substring 3 0 25 25 25 25 NULL NULL NULL
  1162. query TTTTTT colnames
  1163. SELECT proname, protrftypes, prosrc, probin, proconfig, proacl
  1164. FROM pg_catalog.pg_proc
  1165. WHERE proname='substring'
  1166. ----
  1167. proname protrftypes prosrc probin proconfig proacl
  1168. substring NULL substring NULL NULL NULL
  1169. substring NULL substring NULL NULL NULL
  1170. substring NULL substring NULL NULL NULL
  1171. substring NULL substring NULL NULL NULL
  1172. query TOIOTT colnames
  1173. SELECT proname, provariadic, pronargs, prorettype, proargtypes, proargmodes
  1174. FROM pg_catalog.pg_proc
  1175. WHERE proname='least'
  1176. ----
  1177. proname provariadic pronargs prorettype proargtypes proargmodes
  1178. least 2283 1 2283 2283 {v}
  1179. query TOIOTT colnames
  1180. SELECT proname, provariadic, pronargs, prorettype, proargtypes, proargmodes
  1181. FROM pg_catalog.pg_proc
  1182. WHERE proname='json_extract_path'
  1183. ----
  1184. proname provariadic pronargs prorettype proargtypes proargmodes
  1185. json_extract_path 25 2 3802 3802 25 {i,v}
  1186. ## pg_catalog.pg_range
  1187. query IIIIII colnames
  1188. SELECT * from pg_catalog.pg_range
  1189. ----
  1190. rngtypid rngsubtype rngcollation rngsubopc rngcanonical rngsubdiff
  1191. ## pg_catalog.pg_roles
  1192. query OTBBBBBBB colnames
  1193. SELECT oid, rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcatupdate, rolcanlogin, rolreplication
  1194. FROM pg_catalog.pg_roles
  1195. ORDER BY rolname
  1196. ----
  1197. oid rolname rolsuper rolinherit rolcreaterole rolcreatedb rolcatupdate rolcanlogin rolreplication
  1198. 2310524507 admin true true true true false false false
  1199. 1546506610 root true false true true false true false
  1200. 2264919399 testuser false false false false false true false
  1201. query OTITTBT colnames
  1202. SELECT oid, rolname, rolconnlimit, rolpassword, rolvaliduntil, rolbypassrls, rolconfig
  1203. FROM pg_catalog.pg_roles
  1204. ORDER BY rolname
  1205. ----
  1206. oid rolname rolconnlimit rolpassword rolvaliduntil rolbypassrls rolconfig
  1207. 2310524507 admin -1 ******** NULL false NULL
  1208. 1546506610 root -1 ******** NULL false NULL
  1209. 2264919399 testuser -1 ******** NULL false NULL
  1210. ## pg_catalog.pg_auth_members
  1211. query OOOB colnames
  1212. SELECT roleid, member, grantor, admin_option
  1213. FROM pg_catalog.pg_auth_members
  1214. ----
  1215. roleid member grantor admin_option
  1216. 2310524507 1546506610 NULL true
  1217. ## pg_catalog.pg_user
  1218. query TOBBBBTTA colnames
  1219. SELECT usename, usesysid, usecreatedb, usesuper, userepl, usebypassrls, passwd, valuntil, useconfig
  1220. FROM pg_catalog.pg_user
  1221. ORDER BY usename
  1222. ----
  1223. usename usesysid usecreatedb usesuper userepl usebypassrls passwd valuntil useconfig
  1224. root 1546506610 true true false false ******** NULL NULL
  1225. testuser 2264919399 false false false false ******** NULL NULL
  1226. ## pg_catalog.pg_description
  1227. query OOIT colnames
  1228. SELECT objoid, classoid, objsubid, regexp_replace(description, e'\n.*', '') AS description
  1229. FROM pg_catalog.pg_description
  1230. ----
  1231. objoid classoid objsubid description
  1232. 4294967294 4294967234 0 backward inter-descriptor dependencies starting from tables accessible by current user in current database (KV scan)
  1233. 4294967292 4294967234 0 built-in functions (RAM/static)
  1234. 4294967291 4294967234 0 running queries visible by current user (cluster RPC; expensive!)
  1235. 4294967290 4294967234 0 running sessions visible to current user (cluster RPC; expensive!)
  1236. 4294967289 4294967234 0 cluster settings (RAM)
  1237. 4294967288 4294967234 0 CREATE and ALTER statements for all tables accessible by current user in current database (KV scan)
  1238. 4294967287 4294967234 0 telemetry counters (RAM; local node only)
  1239. 4294967286 4294967234 0 forward inter-descriptor dependencies starting from tables accessible by current user in current database (KV scan)
  1240. 4294967284 4294967234 0 locally known gossiped health alerts (RAM; local node only)
  1241. 4294967283 4294967234 0 locally known gossiped node liveness (RAM; local node only)
  1242. 4294967282 4294967234 0 locally known edges in the gossip network (RAM; local node only)
  1243. 4294967285 4294967234 0 locally known gossiped node details (RAM; local node only)
  1244. 4294967281 4294967234 0 index columns for all indexes accessible by current user in current database (KV scan)
  1245. 4294967280 4294967234 0 decoded job metadata from system.jobs (KV scan)
  1246. 4294967279 4294967234 0 node details across the entire cluster (cluster RPC; expensive!)
  1247. 4294967278 4294967234 0 store details and status (cluster RPC; expensive!)
  1248. 4294967277 4294967234 0 acquired table leases (RAM; local node only)
  1249. 4294967293 4294967234 0 detailed identification strings (RAM, local node only)
  1250. 4294967274 4294967234 0 current values for metrics (RAM; local node only)
  1251. 4294967276 4294967234 0 running queries visible by current user (RAM; local node only)
  1252. 4294967269 4294967234 0 server parameters, useful to construct connection URLs (RAM, local node only)
  1253. 4294967275 4294967234 0 running sessions visible by current user (RAM; local node only)
  1254. 4294967265 4294967234 0 statement statistics (RAM; local node only)
  1255. 4294967273 4294967234 0 defined partitions for all tables/indexes accessible by the current user in the current database (KV scan)
  1256. 4294967272 4294967234 0 comments for predefined virtual tables (RAM/static)
  1257. 4294967271 4294967234 0 range metadata without leaseholder details (KV join; expensive!)
  1258. 4294967268 4294967234 0 ongoing schema changes, across all descriptors accessible by current user (KV scan; expensive!)
  1259. 4294967267 4294967234 0 session trace accumulated so far (RAM)
  1260. 4294967266 4294967234 0 session variables (RAM)
  1261. 4294967264 4294967234 0 details for all columns accessible by current user in current database (KV scan)
  1262. 4294967263 4294967234 0 indexes accessible by current user in current database (KV scan)
  1263. 4294967262 4294967234 0 table descriptors accessible by current user, including non-public and virtual (KV scan; expensive!)
  1264. 4294967261 4294967234 0 decoded zone configurations from system.zones (KV scan)
  1265. 4294967259 4294967234 0 roles for which the current user has admin option
  1266. 4294967258 4294967234 0 roles available to the current user
  1267. 4294967257 4294967234 0 column privilege grants (incomplete)
  1268. 4294967256 4294967234 0 table and view columns (incomplete)
  1269. 4294967255 4294967234 0 columns usage by constraints
  1270. 4294967254 4294967234 0 roles for the current user
  1271. 4294967253 4294967234 0 column usage by indexes and key constraints
  1272. 4294967252 4294967234 0 built-in function parameters (empty - introspection not yet supported)
  1273. 4294967251 4294967234 0 foreign key constraints
  1274. 4294967250 4294967234 0 privileges granted on table or views (incomplete; see also information_schema.table_privileges; may contain excess users or roles)
  1275. 4294967249 4294967234 0 built-in functions (empty - introspection not yet supported)
  1276. 4294967247 4294967234 0 schema privileges (incomplete; may contain excess users or roles)
  1277. 4294967248 4294967234 0 database schemas (may contain schemata without permission)
  1278. 4294967246 4294967234 0 sequences
  1279. 4294967245 4294967234 0 index metadata and statistics (incomplete)
  1280. 4294967244 4294967234 0 table constraints
  1281. 4294967243 4294967234 0 privileges granted on table or views (incomplete; may contain excess users or roles)
  1282. 4294967242 4294967234 0 tables and views
  1283. 4294967240 4294967234 0 grantable privileges (incomplete)
  1284. 4294967241 4294967234 0 views (incomplete)
  1285. 4294967238 4294967234 0 index access methods (incomplete)
  1286. 4294967237 4294967234 0 column default values
  1287. 4294967236 4294967234 0 table columns (incomplete - see also information_schema.columns)
  1288. 4294967235 4294967234 0 role membership
  1289. 4294967234 4294967234 0 tables and relation-like objects (incomplete - see also information_schema.tables/sequences/views)
  1290. 4294967233 4294967234 0 available collations (incomplete)
  1291. 4294967232 4294967234 0 table constraints (incomplete - see also information_schema.table_constraints)
  1292. 4294967231 4294967234 0 available databases (incomplete)
  1293. 4294967230 4294967234 0 dependency relationships (incomplete)
  1294. 4294967229 4294967234 0 object comments
  1295. 4294967227 4294967234 0 enum types and labels (empty - feature does not exist)
  1296. 4294967226 4294967234 0 installed extensions (empty - feature does not exist)
  1297. 4294967225 4294967234 0 foreign data wrappers (empty - feature does not exist)
  1298. 4294967224 4294967234 0 foreign servers (empty - feature does not exist)
  1299. 4294967223 4294967234 0 foreign tables (empty - feature does not exist)
  1300. 4294967222 4294967234 0 indexes (incomplete)
  1301. 4294967221 4294967234 0 index creation statements
  1302. 4294967220 4294967234 0 table inheritance hierarchy (empty - feature does not exist)
  1303. 4294967219 4294967234 0 available languages (empty - feature does not exist)
  1304. 4294967218 4294967234 0 available namespaces (incomplete; namespaces and databases are congruent in CockroachDB)
  1305. 4294967217 4294967234 0 operators (incomplete)
  1306. 4294967216 4294967234 0 built-in functions (incomplete)
  1307. 4294967215 4294967234 0 range types (empty - feature does not exist)
  1308. 4294967214 4294967234 0 rewrite rules (empty - feature does not exist)
  1309. 4294967213 4294967234 0 database roles
  1310. 4294967202 4294967234 0 security labels (empty - feature does not exist)
  1311. 4294967212 4294967234 0 sequences (see also information_schema.sequences)
  1312. 4294967211 4294967234 0 session variables (incomplete)
  1313. 4294967228 4294967234 0 shared object comments
  1314. 4294967201 4294967234 0 shared security labels (empty - feature not supported)
  1315. 4294967203 4294967234 0 backend access statistics (empty - monitoring works differently in CockroachDB)
  1316. 4294967208 4294967234 0 tables summary (see also information_schema.tables, pg_catalog.pg_class)
  1317. 4294967207 4294967234 0 available tablespaces (incomplete; concept inapplicable to CockroachDB)
  1318. 4294967206 4294967234 0 triggers (empty - feature does not exist)
  1319. 4294967205 4294967234 0 scalar types (incomplete)
  1320. 4294967210 4294967234 0 database users
  1321. 4294967209 4294967234 0 local to remote user mapping (empty - feature does not exist)
  1322. 4294967204 4294967234 0 view definitions (incomplete - see also information_schema.views)
  1323. ## pg_catalog.pg_shdescription
  1324. query OOT colnames
  1325. SELECT objoid, classoid, description FROM pg_catalog.pg_shdescription
  1326. ----
  1327. objoid classoid description
  1328. ## pg_catalog.pg_enum
  1329. query OORT colnames
  1330. SELECT * FROM pg_catalog.pg_enum
  1331. ----
  1332. oid enumtypid enumsortorder enumlabel
  1333. ## pg_catalog.pg_extension
  1334. query OTOOBTTT colnames
  1335. SELECT * FROM pg_catalog.pg_extension
  1336. ----
  1337. oid extname extowner extnamespace extrelocatable extversion extconfig extcondition
  1338. ## pg_catalog.pg_stat_activity
  1339. query OTIOTTTTITTTTTTTIIT colnames
  1340. SELECT * FROM pg_catalog.pg_stat_activity
  1341. ----
  1342. datid datname pid usesysid username application_name client_addr client_hostname client_port backend_start xact_start query_start state_change wait_event_type wait_event state backend_xid backend_xmin query
  1343. query TTBTTTB colnames
  1344. SHOW COLUMNS FROM pg_catalog.pg_stat_activity
  1345. ----
  1346. column_name data_type is_nullable column_default generation_expression indices is_hidden
  1347. datid OID true NULL · {} false
  1348. datname NAME true NULL · {} false
  1349. pid INT8 true NULL · {} false
  1350. usesysid OID true NULL · {} false
  1351. username NAME true NULL · {} false
  1352. application_name STRING true NULL · {} false
  1353. client_addr INET true NULL · {} false
  1354. client_hostname STRING true NULL · {} false
  1355. client_port INT8 true NULL · {} false
  1356. backend_start TIMESTAMPTZ true NULL · {} false
  1357. xact_start TIMESTAMPTZ true NULL · {} false
  1358. query_start TIMESTAMPTZ true NULL · {} false
  1359. state_change TIMESTAMPTZ true NULL · {} false
  1360. wait_event_type STRING true NULL · {} false
  1361. wait_event STRING true NULL · {} false
  1362. state STRING true NULL · {} false
  1363. backend_xid INT8 true NULL · {} false
  1364. backend_xmin INT8 true NULL · {} false
  1365. query STRING true NULL · {} false
  1366. ## pg_catalog.pg_settings
  1367. statement ok
  1368. SET DATABASE = test
  1369. # We filter here because 'optimizer' will be different depending on which
  1370. # configuration this logic test is running in.
  1371. query TTTTTT colnames
  1372. SELECT
  1373. name, setting, category, short_desc, extra_desc, vartype
  1374. FROM
  1375. pg_catalog.pg_settings
  1376. WHERE
  1377. name != 'optimizer' AND name != 'crdb_version'
  1378. ----
  1379. name setting category short_desc extra_desc vartype
  1380. application_name · NULL NULL NULL string
  1381. bytea_output hex NULL NULL NULL string
  1382. client_encoding UTF8 NULL NULL NULL string
  1383. client_min_messages notice NULL NULL NULL string
  1384. database test NULL NULL NULL string
  1385. datestyle ISO, MDY NULL NULL NULL string
  1386. default_int_size 8 NULL NULL NULL string
  1387. default_tablespace · NULL NULL NULL string
  1388. default_transaction_isolation serializable NULL NULL NULL string
  1389. default_transaction_read_only off NULL NULL NULL string
  1390. distsql off NULL NULL NULL string
  1391. experimental_enable_zigzag_join on NULL NULL NULL string
  1392. experimental_force_split_at off NULL NULL NULL string
  1393. experimental_serial_normalization rowid NULL NULL NULL string
  1394. experimental_vectorize off NULL NULL NULL string
  1395. extra_float_digits 0 NULL NULL NULL string
  1396. force_savepoint_restart off NULL NULL NULL string
  1397. idle_in_transaction_session_timeout 0 NULL NULL NULL string
  1398. integer_datetimes on NULL NULL NULL string
  1399. intervalstyle postgres NULL NULL NULL string
  1400. lock_timeout 0 NULL NULL NULL string
  1401. max_index_keys 32 NULL NULL NULL string
  1402. node_id 1 NULL NULL NULL string
  1403. reorder_joins_limit 4 NULL NULL NULL string
  1404. results_buffer_size 16384 NULL NULL NULL string
  1405. row_security off NULL NULL NULL string
  1406. search_path public NULL NULL NULL string
  1407. server_encoding UTF8 NULL NULL NULL string
  1408. server_version 9.5.0 NULL NULL NULL string
  1409. server_version_num 90500 NULL NULL NULL string
  1410. session_user root NULL NULL NULL string
  1411. sql_safe_updates off NULL NULL NULL string
  1412. standard_conforming_strings on NULL NULL NULL string
  1413. statement_timeout 0 NULL NULL NULL string
  1414. synchronize_seqscans on NULL NULL NULL string
  1415. timezone UTC NULL NULL NULL string
  1416. tracing off NULL NULL NULL string
  1417. transaction_isolation serializable NULL NULL NULL string
  1418. transaction_priority normal NULL NULL NULL string
  1419. transaction_read_only off NULL NULL NULL string
  1420. transaction_status NoTxn NULL NULL NULL string
  1421. query TTTTTTT colnames
  1422. SELECT
  1423. name, setting, unit, context, enumvals, boot_val, reset_val
  1424. FROM
  1425. pg_catalog.pg_settings
  1426. WHERE
  1427. name != 'optimizer' AND name != 'crdb_version'
  1428. ----
  1429. name setting unit context enumvals boot_val reset_val
  1430. application_name · NULL user NULL · ·
  1431. bytea_output hex NULL user NULL hex hex
  1432. client_encoding UTF8 NULL user NULL UTF8 UTF8
  1433. client_min_messages notice NULL user NULL notice notice
  1434. database test NULL user NULL · test
  1435. datestyle ISO, MDY NULL user NULL ISO, MDY ISO, MDY
  1436. default_int_size 8 NULL user NULL 8 8
  1437. default_tablespace · NULL user NULL · ·
  1438. default_transaction_isolation serializable NULL user NULL default default
  1439. default_transaction_read_only off NULL user NULL off off
  1440. distsql off NULL user NULL off off
  1441. experimental_enable_zigzag_join on NULL user NULL on on
  1442. experimental_force_split_at off NULL user NULL off off
  1443. experimental_serial_normalization rowid NULL user NULL rowid rowid
  1444. experimental_vectorize off NULL user NULL off off
  1445. extra_float_digits 0 NULL user NULL 0 2
  1446. force_savepoint_restart off NULL user NULL off off
  1447. idle_in_transaction_session_timeout 0 NULL user NULL 0 0
  1448. integer_datetimes on NULL user NULL on on
  1449. intervalstyle postgres NULL user NULL postgres postgres
  1450. lock_timeout 0 NULL user NULL 0 0
  1451. max_index_keys 32 NULL user NULL 32 32
  1452. node_id 1 NULL user NULL 1 1
  1453. reorder_joins_limit 4 NULL user NULL 4 4
  1454. results_buffer_size 16384 NULL user NULL 16384 16384
  1455. row_security off NULL user NULL off off
  1456. search_path public NULL user NULL public public
  1457. server_encoding UTF8 NULL user NULL UTF8 UTF8
  1458. server_version 9.5.0 NULL user NULL 9.5.0 9.5.0
  1459. server_version_num 90500 NULL user NULL 90500 90500
  1460. session_user root NULL user NULL root root
  1461. sql_safe_updates off NULL user NULL off off
  1462. standard_conforming_strings on NULL user NULL on on
  1463. statement_timeout 0 NULL user NULL 0 0
  1464. synchronize_seqscans on NULL user NULL on on
  1465. timezone UTC NULL user NULL UTC UTC
  1466. tracing off NULL user NULL off off
  1467. transaction_isolation serializable NULL user NULL serializable serializable
  1468. transaction_priority normal NULL user NULL normal normal
  1469. transaction_read_only off NULL user NULL off off
  1470. transaction_status NoTxn NULL user NULL NoTxn NoTxn
  1471. query TTTTTT colnames
  1472. SELECT name, source, min_val, max_val, sourcefile, sourceline FROM pg_catalog.pg_settings
  1473. ----
  1474. name source min_val max_val sourcefile sourceline
  1475. application_name NULL NULL NULL NULL NULL
  1476. bytea_output NULL NULL NULL NULL NULL
  1477. client_encoding NULL NULL NULL NULL NULL
  1478. client_min_messages NULL NULL NULL NULL NULL
  1479. crdb_version NULL NULL NULL NULL NULL
  1480. database NULL NULL NULL NULL NULL
  1481. datestyle NULL NULL NULL NULL NULL
  1482. default_int_size NULL NULL NULL NULL NULL
  1483. default_tablespace NULL NULL NULL NULL NULL
  1484. default_transaction_isolation NULL NULL NULL NULL NULL
  1485. default_transaction_read_only NULL NULL NULL NULL NULL
  1486. distsql NULL NULL NULL NULL NULL
  1487. experimental_enable_zigzag_join NULL NULL NULL NULL NULL
  1488. experimental_force_split_at NULL NULL NULL NULL NULL
  1489. experimental_serial_normalization NULL NULL NULL NULL NULL
  1490. experimental_vectorize NULL NULL NULL NULL NULL
  1491. extra_float_digits NULL NULL NULL NULL NULL
  1492. force_savepoint_restart NULL NULL NULL NULL NULL
  1493. idle_in_transaction_session_timeout NULL NULL NULL NULL NULL
  1494. integer_datetimes NULL NULL NULL NULL NULL
  1495. intervalstyle NULL NULL NULL NULL NULL
  1496. lock_timeout NULL NULL NULL NULL NULL
  1497. max_index_keys NULL NULL NULL NULL NULL
  1498. node_id NULL NULL NULL NULL NULL
  1499. optimizer NULL NULL NULL NULL NULL
  1500. reorder_joins_limit NULL NULL NULL NULL NULL
  1501. results_buffer_size NULL NULL NULL NULL NULL
  1502. row_security NULL NULL NULL NULL NULL
  1503. search_path NULL NULL NULL NULL NULL
  1504. server_encoding NULL NULL NULL NULL NULL
  1505. server_version NULL NULL NULL NULL NULL
  1506. server_version_num NULL NULL NULL NULL NULL
  1507. session_user NULL NULL NULL NULL NULL
  1508. sql_safe_updates NULL NULL NULL NULL NULL
  1509. standard_conforming_strings NULL NULL NULL NULL NULL
  1510. statement_timeout NULL NULL NULL NULL NULL
  1511. synchronize_seqscans NULL NULL NULL NULL NULL
  1512. timezone NULL NULL NULL NULL NULL
  1513. tracing NULL NULL NULL NULL NULL
  1514. transaction_isolation NULL NULL NULL NULL NULL
  1515. transaction_priority NULL NULL NULL NULL NULL
  1516. transaction_read_only NULL NULL NULL NULL NULL
  1517. transaction_status NULL NULL NULL NULL NULL
  1518. # pg_catalog.pg_sequence
  1519. statement ok
  1520. CREATE DATABASE seq
  1521. query OOIIIIIB
  1522. SELECT * FROM pg_catalog.pg_sequence
  1523. ----
  1524. statement ok
  1525. CREATE SEQUENCE foo
  1526. statement ok
  1527. CREATE SEQUENCE bar MAXVALUE 10 MINVALUE 5 START 6 INCREMENT 2
  1528. query OOIIIIIB colnames
  1529. SELECT * FROM pg_catalog.pg_sequence
  1530. ----
  1531. seqrelid seqtypid seqstart seqincrement seqmax seqmin seqcache seqcycle
  1532. 64 20 1 1 9223372036854775807 1 1 false
  1533. 65 20 6 2 10 5 1 false
  1534. statement ok
  1535. DROP DATABASE seq
  1536. statement ok
  1537. SET database = constraint_db
  1538. # Verify sequences can't be seen from another database.
  1539. query OOIIIIIB
  1540. SELECT * FROM pg_catalog.pg_sequence
  1541. ----
  1542. ## pg_catalog.pg_operator
  1543. query OTOOTBBOOOOOOOO colnames
  1544. SELECT * FROM pg_catalog.pg_operator where oprname='+' and oprleft='float8'::regtype
  1545. ----
  1546. oid oprname oprnamespace oprowner oprkind oprcanmerge oprcanhash oprleft oprright oprresult oprcom oprnegate oprcode oprrest oprjoin
  1547. 74817020 + 1307062959 NULL b false false 701 701 701 NULL NULL NULL NULL NULL
  1548. # Verify proper functionality of system information functions.
  1549. query TT
  1550. SELECT pg_catalog.pg_get_expr('1', 0), pg_catalog.pg_get_expr('1', 0::OID)
  1551. ----
  1552. 1 1
  1553. query T
  1554. SELECT pg_catalog.pg_get_expr('1', 0, true)
  1555. ----
  1556. 1
  1557. statement ok
  1558. SET DATABASE = constraint_db
  1559. query OTT
  1560. SELECT def.oid, c.relname, pg_catalog.pg_get_expr(def.adbin, def.adrelid)
  1561. FROM pg_catalog.pg_attrdef def
  1562. JOIN pg_catalog.pg_class c ON def.adrelid = c.oid
  1563. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  1564. WHERE n.nspname = 'public'
  1565. ----
  1566. 1666782879 t1 12:::INT8
  1567. 841178406 t2 unique_rowid()
  1568. 2186255414 t3 'FOO':::STRING
  1569. 2186255409 t3 unique_rowid()
  1570. # Verify that a set database shows tables from that database for a non-root
  1571. # user, when that user has permissions.
  1572. statement ok
  1573. GRANT ALL ON constraint_db.* TO testuser
  1574. user testuser
  1575. statement ok
  1576. SET DATABASE = 'constraint_db'
  1577. query I
  1578. SELECT count(*) FROM pg_catalog.pg_tables WHERE schemaname='public'
  1579. ----
  1580. 3
  1581. user root
  1582. # Verify that an unset database shows tables across databases.
  1583. # But only those items visible to this user are reported.
  1584. # (Tests below show that root sees more).
  1585. statement ok
  1586. SET DATABASE = ''
  1587. query error cannot access virtual schema in anonymous database
  1588. SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname='public' ORDER BY 1
  1589. query error cannot access virtual schema in anonymous database
  1590. SELECT viewname FROM pg_catalog.pg_views WHERE schemaname='public' ORDER BY 1
  1591. query error cannot access virtual schema in anonymous database
  1592. SELECT relname FROM pg_catalog.pg_class c
  1593. JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
  1594. WHERE nspname='public'
  1595. query error cannot access virtual schema in anonymous database
  1596. SELECT conname FROM pg_catalog.pg_constraint con
  1597. JOIN pg_catalog.pg_namespace n ON con.connamespace = n.oid
  1598. WHERE n.nspname = 'public'
  1599. query error cannot access virtual schema in anonymous database
  1600. SELECT count(*) FROM pg_catalog.pg_depend
  1601. query error cannot access virtual schema in anonymous database
  1602. select 'upper'::REGPROC;
  1603. query error cannot access virtual schema in anonymous database
  1604. select 'system.namespace'::regclass
  1605. statement ok
  1606. SET DATABASE = test
  1607. ## materialize#13567
  1608. ## regproc columns display as text but can still be joined against oid columns
  1609. query OTO
  1610. SELECT p.oid, p.proname, t.typinput
  1611. FROM pg_proc p
  1612. JOIN pg_type t ON t.typinput = p.oid
  1613. WHERE t.typname = '_int4'
  1614. ----
  1615. 780513238 array_in array_in
  1616. ## materialize#16285
  1617. ## int2vectors should be 0-indexed
  1618. query I
  1619. SELECT count(*) FROM pg_catalog.pg_index WHERE indkey[0] IS NULL;
  1620. ----
  1621. 0
  1622. ## Ensure no two builtins have the same oid.
  1623. query I
  1624. SELECT c FROM (SELECT oid, count(*) as c FROM pg_catalog.pg_proc GROUP BY oid) WHERE c > 1
  1625. ----
  1626. ## Ensure that unnest works with oid wrapper arrays
  1627. query O
  1628. SELECT unnest((SELECT proargtypes FROM pg_proc WHERE proname='split_part'));
  1629. ----
  1630. 25
  1631. 25
  1632. 20
  1633. ## TODO(masha): cockroach#16769
  1634. #statement ok
  1635. #CREATE TABLE types(a int8, b int2);
  1636. #query I
  1637. #SELECT attname, atttypid, typname FROM pg_attribute a JOIN pg_type t ON a.atttypid=t.oid WHERE attrelid = 'types'::REGCLASS;
  1638. #attname atttypid typname
  1639. #a 20 int8
  1640. #b 20 int2
  1641. subtest pg_catalog.pg_seclabel
  1642. query OOOTT colnames
  1643. SELECT objoid, classoid, objsubid, provider, label FROM pg_catalog.pg_seclabel
  1644. ----
  1645. objoid classoid objsubid provider label
  1646. subtest pg_catalog.pg_shseclabel
  1647. query OOTT colnames
  1648. SELECT objoid, classoid, provider, label FROM pg_catalog.pg_shseclabel
  1649. ----
  1650. objoid classoid provider label
  1651. subtest collated_string_type
  1652. statement ok
  1653. CREATE TABLE coltab (a STRING COLLATE en)
  1654. query OT
  1655. SELECT typ.oid, typ.typname FROM pg_attribute att JOIN pg_type typ ON atttypid=typ.oid WHERE attrelid='coltab'::regclass AND attname='a'
  1656. ----
  1657. 25 text
  1658. subtest 31545
  1659. # Test an index of 2 referencing an index of 2.
  1660. statement ok
  1661. CREATE TABLE a (
  1662. id_a_1 INT UNIQUE,
  1663. id_a_2 INT,
  1664. PRIMARY KEY (id_a_1, id_a_2)
  1665. )
  1666. statement ok
  1667. CREATE TABLE b (
  1668. id_b_1 INT,
  1669. id_b_2 INT,
  1670. PRIMARY KEY (id_b_1, id_b_2),
  1671. CONSTRAINT my_fkey FOREIGN KEY (id_b_1, id_b_2) REFERENCES a (id_a_1, id_a_2)
  1672. )
  1673. query TT colnames
  1674. SELECT conkey, confkey FROM pg_catalog.pg_constraint WHERE conname = 'my_fkey'
  1675. ----
  1676. conkey confkey
  1677. {1,2} {1,2}
  1678. # Test an index of 3 referencing an index of 2.
  1679. statement ok
  1680. DROP TABLE b;
  1681. CREATE TABLE b (
  1682. id_b_1 INT,
  1683. id_b_2 INT,
  1684. id_b_3 INT,
  1685. PRIMARY KEY (id_b_1, id_b_2, id_b_3),
  1686. CONSTRAINT my_fkey FOREIGN KEY (id_b_1, id_b_2) REFERENCES a (id_a_1, id_a_2)
  1687. )
  1688. query TT colnames
  1689. SELECT conkey, confkey FROM pg_catalog.pg_constraint WHERE conname = 'my_fkey'
  1690. ----
  1691. conkey confkey
  1692. {1,2} {1,2}
  1693. # Test an index of 3 referencing an index of 1.
  1694. statement ok
  1695. DROP TABLE b;
  1696. CREATE TABLE b (
  1697. id_b_1 INT,
  1698. id_b_2 INT,
  1699. id_b_3 INT,
  1700. PRIMARY KEY (id_b_1, id_b_2, id_b_3),
  1701. CONSTRAINT my_fkey FOREIGN KEY (id_b_1) REFERENCES a (id_a_1)
  1702. )
  1703. query TT colnames
  1704. SELECT conkey, confkey FROM pg_catalog.pg_constraint WHERE conname = 'my_fkey'
  1705. ----
  1706. conkey confkey
  1707. {1} {1}
  1708. subtest regression_34856
  1709. statement ok
  1710. CREATE DATABASE d34856
  1711. statement ok
  1712. CREATE TABLE d34856.t(x INT);
  1713. CREATE VIEW d34856.v AS SELECT x FROM d34856.t;
  1714. CREATE SEQUENCE d34856.s
  1715. # Check that only tables show up in pg_tables.
  1716. query T
  1717. SELECT tablename FROM d34856.pg_catalog.pg_tables WHERE schemaname = 'public'
  1718. ----
  1719. t
  1720. statement ok
  1721. DROP DATABASE d34856 CASCADE
  1722. subtest regression_34862
  1723. statement ok
  1724. CREATE DATABASE d34862; SET database=d34862
  1725. statement ok
  1726. CREATE TABLE t(x INT UNIQUE);
  1727. CREATE TABLE u(
  1728. a INT REFERENCES t(x) ON DELETE NO ACTION,
  1729. b INT REFERENCES t(x) ON DELETE RESTRICT,
  1730. c INT REFERENCES t(x) ON DELETE SET NULL,
  1731. d INT DEFAULT 123 REFERENCES t(x) ON DELETE SET DEFAULT,
  1732. e INT REFERENCES t(x) ON DELETE CASCADE,
  1733. f INT REFERENCES t(x) ON UPDATE NO ACTION,
  1734. g INT REFERENCES t(x) ON UPDATE RESTRICT,
  1735. h INT REFERENCES t(x) ON UPDATE SET NULL,
  1736. i INT DEFAULT 123 REFERENCES t(x) ON UPDATE SET DEFAULT,
  1737. j INT REFERENCES t(x) ON UPDATE CASCADE,
  1738. k INT REFERENCES t(x) ON DELETE RESTRICT ON UPDATE SET NULL
  1739. );
  1740. query TTT
  1741. SELECT conname, confupdtype, confdeltype FROM pg_constraint ORDER BY conname
  1742. ----
  1743. fk_a_ref_t a a
  1744. fk_b_ref_t a r
  1745. fk_c_ref_t a n
  1746. fk_d_ref_t a d
  1747. fk_e_ref_t a c
  1748. fk_f_ref_t a a
  1749. fk_g_ref_t r a
  1750. fk_h_ref_t n a
  1751. fk_i_ref_t d a
  1752. fk_j_ref_t c a
  1753. fk_k_ref_t n r
  1754. t_x_key NULL NULL
  1755. statement ok
  1756. DROP TABLE u; DROP TABLE t
  1757. statement ok
  1758. CREATE TABLE v(x INT, y INT, UNIQUE (x,y))
  1759. statement ok
  1760. CREATE TABLE w(
  1761. a INT, b INT, c INT, d INT,
  1762. FOREIGN KEY (a,b) REFERENCES v(x,y) MATCH FULL,
  1763. FOREIGN KEY (c,d) REFERENCES v(x,y) MATCH SIMPLE
  1764. );
  1765. query TT
  1766. SELECT conname, confmatchtype FROM pg_constraint ORDER BY conname
  1767. ----
  1768. fk_a_ref_v f
  1769. fk_c_ref_v s
  1770. v_x_y_key NULL
  1771. statement ok
  1772. DROP DATABASE d34862 CASCADE; SET database=test
  1773. subtest regression_35108
  1774. query T
  1775. SELECT pg_catalog.current_setting('statement_timeout')
  1776. ----
  1777. 0
  1778. query T
  1779. SELECT pg_catalog.current_setting('statement_timeout', false)
  1780. ----
  1781. 0
  1782. # check returns null on unsupported session var.
  1783. query T
  1784. SELECT IFNULL(pg_catalog.current_setting('woo', true), 'OK')
  1785. ----
  1786. OK
  1787. # check error on nonexistent session var.
  1788. query error unrecognized configuration parameter
  1789. SELECT pg_catalog.current_setting('woo', false)
  1790. # check error on unsupported session var.
  1791. query error configuration setting.*not supported
  1792. SELECT pg_catalog.current_setting('vacuum_cost_delay', false)
  1793. query T
  1794. SHOW application_name
  1795. ----
  1796. ·
  1797. query T
  1798. SELECT pg_catalog.set_config('application_name', 'woo', false)
  1799. ----
  1800. woo
  1801. query T
  1802. SHOW application_name
  1803. ----
  1804. woo
  1805. query error transaction-scoped settings are not supported
  1806. SELECT pg_catalog.set_config('application_name', 'woo', true)
  1807. query error unrecognized configuration parameter
  1808. SELECT pg_catalog.set_config('woo', 'woo', false)
  1809. query error configuration setting.*not supported
  1810. SELECT pg_catalog.set_config('vacuum_cost_delay', '0', false)