privilege_checks.slt 80 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. mode cockroach
  10. reset-server
  11. # Enable rbac checks.
  12. simple conn=mz_system,user=mz_system
  13. ALTER SYSTEM SET enable_rbac_checks TO true;
  14. ----
  15. COMPLETE 0
  16. simple conn=mz_system,user=mz_system
  17. ALTER SYSTEM SET enable_connection_validation_syntax TO true;
  18. ----
  19. COMPLETE 0
  20. simple conn=mz_system,user=mz_system
  21. CREATE ROLE joe;
  22. ----
  23. COMPLETE 0
  24. simple conn=mz_system,user=mz_system
  25. CREATE ROLE other;
  26. ----
  27. COMPLETE 0
  28. simple conn=mz_system,user=mz_system
  29. GRANT other TO joe;
  30. ----
  31. COMPLETE 0
  32. simple conn=mz_system,user=mz_system
  33. CREATE ROLE child;
  34. ----
  35. COMPLETE 0
  36. simple conn=mz_system,user=mz_system
  37. GRANT joe TO child;
  38. ----
  39. COMPLETE 0
  40. simple conn=mz_system,user=mz_system
  41. REVOKE USAGE ON SCHEMA materialize.public FROM PUBLIC;
  42. ----
  43. COMPLETE 0
  44. simple conn=mz_system,user=mz_system
  45. REVOKE USAGE ON DATABASE materialize FROM PUBLIC;
  46. ----
  47. COMPLETE 0
  48. simple conn=mz_system,user=mz_system
  49. REVOKE USAGE ON CLUSTER quickstart FROM PUBLIC;
  50. ----
  51. COMPLETE 0
  52. # CREATE CONNECTION
  53. simple conn=joe,user=joe
  54. CREATE CONNECTION conn TO KAFKA (BROKER 'localhost:9092', SECURITY PROTOCOL PLAINTEXT) WITH (VALIDATE = false);
  55. ----
  56. db error: ERROR: permission denied for SCHEMA "materialize.public"
  57. DETAIL: The 'joe' role needs CREATE privileges on SCHEMA "materialize.public"
  58. simple conn=child,user=child
  59. CREATE CONNECTION conn TO KAFKA (BROKER 'localhost:9092', SECURITY PROTOCOL PLAINTEXT) WITH (VALIDATE = false);
  60. ----
  61. db error: ERROR: permission denied for SCHEMA "materialize.public"
  62. DETAIL: The 'child' role needs CREATE privileges on SCHEMA "materialize.public"
  63. simple conn=mz_system,user=mz_system
  64. GRANT CREATE ON SCHEMA materialize.public TO joe;
  65. ----
  66. COMPLETE 0
  67. simple conn=joe,user=joe
  68. CREATE CONNECTION conn TO KAFKA (BROKER 'localhost:9092', SECURITY PROTOCOL PLAINTEXT) WITH (VALIDATE = false);
  69. ----
  70. COMPLETE 0
  71. simple conn=child,user=child
  72. CREATE CONNECTION conn1 TO KAFKA (BROKER 'localhost:9092', SECURITY PROTOCOL PLAINTEXT) WITH (VALIDATE = false);
  73. ----
  74. COMPLETE 0
  75. simple conn=mz_system,user=mz_system
  76. REVOKE CREATE ON SCHEMA materialize.public FROM joe;
  77. ----
  78. COMPLETE 0
  79. # CREATE DATABASE
  80. simple conn=joe,user=joe
  81. CREATE DATABASE d;
  82. ----
  83. db error: ERROR: permission denied for SYSTEM
  84. DETAIL: The 'joe' role needs CREATEDB privileges on SYSTEM
  85. simple conn=child,user=child
  86. CREATE DATABASE d;
  87. ----
  88. db error: ERROR: permission denied for SYSTEM
  89. DETAIL: The 'child' role needs CREATEDB privileges on SYSTEM
  90. simple conn=mz_system,user=mz_system
  91. GRANT CREATEDB ON SYSTEM TO joe;
  92. ----
  93. COMPLETE 0
  94. simple conn=joe,user=joe
  95. CREATE DATABASE d;
  96. ----
  97. COMPLETE 0
  98. simple conn=child,user=child
  99. CREATE DATABASE d1;
  100. ----
  101. COMPLETE 0
  102. simple conn=mz_system,user=mz_system
  103. REVOKE CREATEDB ON SYSTEM FROM joe;
  104. ----
  105. COMPLETE 0
  106. # CREATE CLUSTER
  107. simple conn=joe,user=joe
  108. CREATE CLUSTER c REPLICAS (r1 (SIZE '1'));
  109. ----
  110. db error: ERROR: permission denied for SYSTEM
  111. DETAIL: The 'joe' role needs CREATECLUSTER privileges on SYSTEM
  112. simple conn=child,user=child
  113. CREATE CLUSTER c REPLICAS (r1 (SIZE '1'));
  114. ----
  115. db error: ERROR: permission denied for SYSTEM
  116. DETAIL: The 'child' role needs CREATECLUSTER privileges on SYSTEM
  117. simple conn=mz_system,user=mz_system
  118. GRANT CREATECLUSTER ON SYSTEM TO joe;
  119. ----
  120. COMPLETE 0
  121. simple conn=joe,user=joe
  122. CREATE CLUSTER c REPLICAS (r1 (SIZE '1'));
  123. ----
  124. COMPLETE 0
  125. simple conn=child,user=child
  126. CREATE CLUSTER c1 REPLICAS (r1 (SIZE '1'));
  127. ----
  128. COMPLETE 0
  129. simple conn=mz_system,user=mz_system
  130. REVOKE CREATECLUSTER ON SYSTEM FROM joe;
  131. ----
  132. COMPLETE 0
  133. # CREATE CLUSTER REPLICA
  134. simple conn=mz_system,user=mz_system
  135. CREATE CLUSTER clus REPLICAS (r1 (SIZE '1'));
  136. ----
  137. COMPLETE 0
  138. simple conn=joe,user=joe
  139. CREATE CLUSTER REPLICA clus.r2 SIZE '1';
  140. ----
  141. db error: ERROR: must be owner of CLUSTER clus
  142. simple conn=child,user=child
  143. CREATE CLUSTER REPLICA clus.r2 SIZE '1';
  144. ----
  145. db error: ERROR: must be owner of CLUSTER clus
  146. simple conn=mz_system,user=mz_system
  147. ALTER CLUSTER clus OWNER TO joe;
  148. ----
  149. COMPLETE 0
  150. simple conn=joe,user=joe
  151. CREATE CLUSTER REPLICA clus.r2 SIZE '1';
  152. ----
  153. COMPLETE 0
  154. simple conn=child,user=child
  155. CREATE CLUSTER REPLICA clus.r3 SIZE '1';
  156. ----
  157. COMPLETE 0
  158. # CREATE SCHEMA
  159. simple conn=joe,user=joe
  160. CREATE SCHEMA sch;
  161. ----
  162. db error: ERROR: permission denied for DATABASE "materialize"
  163. DETAIL: The 'joe' role needs CREATE privileges on DATABASE "materialize"
  164. simple conn=child,user=child
  165. CREATE SCHEMA sch;
  166. ----
  167. db error: ERROR: permission denied for DATABASE "materialize"
  168. DETAIL: The 'child' role needs CREATE privileges on DATABASE "materialize"
  169. simple conn=mz_system,user=mz_system
  170. GRANT CREATE ON DATABASE materialize TO joe;
  171. ----
  172. COMPLETE 0
  173. simple conn=joe,user=joe
  174. CREATE SCHEMA sch;
  175. ----
  176. COMPLETE 0
  177. simple conn=child,user=child
  178. CREATE SCHEMA sch1;
  179. ----
  180. COMPLETE 0
  181. simple conn=mz_system,user=mz_system
  182. REVOKE CREATE ON DATABASE materialize FROM joe;
  183. ----
  184. COMPLETE 0
  185. # CREATE ROLE
  186. simple conn=joe,user=joe
  187. CREATE ROLE r;
  188. ----
  189. db error: ERROR: permission denied for SYSTEM
  190. DETAIL: The 'joe' role needs CREATEROLE privileges on SYSTEM
  191. simple conn=child,user=child
  192. CREATE ROLE r;
  193. ----
  194. db error: ERROR: permission denied for SYSTEM
  195. DETAIL: The 'child' role needs CREATEROLE privileges on SYSTEM
  196. simple conn=mz_system,user=mz_system
  197. GRANT CREATEROLE ON SYSTEM TO joe;
  198. ----
  199. COMPLETE 0
  200. simple conn=joe,user=joe
  201. CREATE ROLE r;
  202. ----
  203. COMPLETE 0
  204. simple conn=child,user=child
  205. CREATE ROLE r1;
  206. ----
  207. COMPLETE 0
  208. simple conn=mz_system,user=mz_system
  209. REVOKE CREATEROLE ON SYSTEM FROM joe;
  210. ----
  211. COMPLETE 0
  212. # ALTER ROLE
  213. simple conn=joe,user=joe
  214. ALTER ROLE r INHERIT;
  215. ----
  216. db error: ERROR: permission denied for SYSTEM
  217. DETAIL: The 'joe' role needs CREATEROLE privileges on SYSTEM
  218. simple conn=child,user=child
  219. ALTER ROLE r1 INHERIT;
  220. ----
  221. db error: ERROR: permission denied for SYSTEM
  222. DETAIL: The 'child' role needs CREATEROLE privileges on SYSTEM
  223. simple conn=mz_system,user=mz_system
  224. GRANT CREATEROLE ON SYSTEM TO joe;
  225. ----
  226. COMPLETE 0
  227. simple conn=joe,user=joe
  228. ALTER ROLE r INHERIT;
  229. ----
  230. COMPLETE 0
  231. simple conn=child,user=child
  232. ALTER ROLE r1 INHERIT;
  233. ----
  234. COMPLETE 0
  235. simple conn=mz_system,user=mz_system
  236. REVOKE CREATEROLE ON SYSTEM FROM joe;
  237. ----
  238. COMPLETE 0
  239. # CREATE SOURCE
  240. simple conn=joe,user=joe
  241. CREATE SOURCE s1 FROM LOAD GENERATOR COUNTER;
  242. ----
  243. db error: ERROR: permission denied for SCHEMA "materialize.public"
  244. DETAIL: The 'joe' role needs CREATE privileges on SCHEMA "materialize.public"
  245. simple conn=child,user=child
  246. CREATE SOURCE s1 FROM LOAD GENERATOR COUNTER;
  247. ----
  248. db error: ERROR: permission denied for SCHEMA "materialize.public"
  249. DETAIL: The 'child' role needs CREATE privileges on SCHEMA "materialize.public"
  250. simple conn=mz_system,user=mz_system
  251. GRANT CREATE ON SCHEMA materialize.public TO joe;
  252. ----
  253. COMPLETE 0
  254. simple conn=joe,user=joe
  255. CREATE SOURCE s1 FROM LOAD GENERATOR COUNTER;
  256. ----
  257. db error: ERROR: permission denied for CLUSTER "quickstart"
  258. DETAIL: The 'joe' role needs CREATE privileges on CLUSTER "quickstart"
  259. simple conn=mz_system,user=mz_system
  260. GRANT CREATE ON CLUSTER quickstart TO joe;
  261. ----
  262. COMPLETE 0
  263. simple conn=joe,user=joe
  264. CREATE SOURCE s1 FROM LOAD GENERATOR COUNTER;
  265. ----
  266. COMPLETE 0
  267. simple conn=mz_system,user=mz_system
  268. CREATE CLUSTER source_cluster REPLICAS (r1 (SIZE '1'));
  269. ----
  270. COMPLETE 0
  271. simple conn=mz_system,user=mz_system
  272. REVOKE CREATECLUSTER ON SYSTEM FROM joe;
  273. ----
  274. COMPLETE 0
  275. simple conn=joe,user=joe
  276. CREATE SOURCE s2 IN CLUSTER source_cluster FROM LOAD GENERATOR COUNTER;
  277. ----
  278. db error: ERROR: permission denied for CLUSTER "source_cluster"
  279. DETAIL: The 'joe' role needs CREATE privileges on CLUSTER "source_cluster"
  280. simple conn=child,user=child
  281. CREATE SOURCE s2 IN CLUSTER source_cluster FROM LOAD GENERATOR COUNTER;
  282. ----
  283. db error: ERROR: permission denied for CLUSTER "source_cluster"
  284. DETAIL: The 'child' role needs CREATE privileges on CLUSTER "source_cluster"
  285. simple conn=joe,user=joe
  286. CREATE SOURCE webhook_text_a IN CLUSTER source_cluster FROM WEBHOOK BODY FORMAT TEXT;
  287. ----
  288. db error: ERROR: permission denied for CLUSTER "source_cluster"
  289. DETAIL: The 'joe' role needs CREATE privileges on CLUSTER "source_cluster"
  290. simple conn=child,user=child
  291. CREATE SOURCE webhook_text_b IN CLUSTER source_cluster FROM WEBHOOK BODY FORMAT TEXT;
  292. ----
  293. db error: ERROR: permission denied for CLUSTER "source_cluster"
  294. DETAIL: The 'child' role needs CREATE privileges on CLUSTER "source_cluster"
  295. simple conn=mz_system,user=mz_system
  296. GRANT CREATE ON CLUSTER source_cluster TO joe;
  297. ----
  298. COMPLETE 0
  299. simple conn=joe,user=joe
  300. CREATE SOURCE s2 IN CLUSTER source_cluster FROM LOAD GENERATOR COUNTER;
  301. ----
  302. COMPLETE 0
  303. simple conn=child,user=child
  304. CREATE SOURCE s4 IN CLUSTER source_cluster FROM LOAD GENERATOR COUNTER;
  305. ----
  306. COMPLETE 0
  307. simple conn=joe,user=joe
  308. CREATE SOURCE webhook_text_a IN CLUSTER source_cluster FROM WEBHOOK BODY FORMAT TEXT;
  309. ----
  310. COMPLETE 0
  311. simple conn=child,user=child
  312. CREATE SOURCE webhook_text_b IN CLUSTER source_cluster FROM WEBHOOK BODY FORMAT TEXT;
  313. ----
  314. COMPLETE 0
  315. simple conn=joe,user=joe
  316. CREATE SECRET webhook_key AS 'shared_key';
  317. ----
  318. COMPLETE 0
  319. simple conn=mz_system,user=mz_system
  320. GRANT USAGE ON SCHEMA materialize.public TO joe;
  321. ----
  322. COMPLETE 0
  323. simple conn=mz_system,user=mz_system
  324. REVOKE USAGE ON SECRET webhook_key FROM joe;
  325. ----
  326. COMPLETE 0
  327. simple conn=joe,user=joe
  328. CREATE SOURCE webhook_text_with_secret IN CLUSTER source_cluster FROM WEBHOOK
  329. BODY FORMAT TEXT
  330. CHECK (
  331. WITH ( BODY, SECRET webhook_key )
  332. body = webhook_key
  333. )
  334. ----
  335. db error: ERROR: permission denied for SECRET "materialize.public.webhook_key"
  336. DETAIL: The 'joe' role needs USAGE privileges on SECRET "materialize.public.webhook_key"
  337. simple conn=child,user=child
  338. CREATE SOURCE webhook_text_with_secret1 IN CLUSTER source_cluster FROM WEBHOOK
  339. BODY FORMAT TEXT
  340. CHECK (
  341. WITH ( BODY, SECRET webhook_key )
  342. body = webhook_key
  343. )
  344. ----
  345. db error: ERROR: permission denied for SECRET "materialize.public.webhook_key"
  346. DETAIL: The 'child' role needs USAGE privileges on SECRET "materialize.public.webhook_key"
  347. simple conn=mz_system,user=mz_system
  348. GRANT USAGE ON SECRET webhook_key TO child;
  349. ----
  350. COMPLETE 0
  351. simple conn=joe,user=joe
  352. CREATE SOURCE webhook_text_with_secret IN CLUSTER source_cluster FROM WEBHOOK
  353. BODY FORMAT TEXT
  354. CHECK (
  355. WITH ( BODY, SECRET webhook_key )
  356. body = webhook_key
  357. )
  358. ----
  359. db error: ERROR: permission denied for SECRET "materialize.public.webhook_key"
  360. DETAIL: The 'joe' role needs USAGE privileges on SECRET "materialize.public.webhook_key"
  361. simple conn=child,user=child
  362. CREATE SOURCE webhook_text_with_secret1 IN CLUSTER source_cluster FROM WEBHOOK
  363. BODY FORMAT TEXT
  364. CHECK (
  365. WITH ( BODY, SECRET webhook_key )
  366. body = webhook_key
  367. )
  368. ----
  369. COMPLETE 0
  370. simple conn=mz_system,user=mz_system
  371. GRANT USAGE ON SECRET webhook_key TO joe;
  372. ----
  373. COMPLETE 0
  374. simple conn=joe,user=joe
  375. CREATE SOURCE webhook_text_with_secret IN CLUSTER source_cluster FROM WEBHOOK
  376. BODY FORMAT TEXT
  377. CHECK (
  378. WITH ( BODY, SECRET webhook_key )
  379. body = webhook_key
  380. )
  381. ----
  382. COMPLETE 0
  383. simple conn=mz_system,user=mz_system
  384. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  385. ----
  386. COMPLETE 0
  387. simple conn=mz_system,user=mz_system
  388. REVOKE CREATE ON SCHEMA materialize.public FROM joe;
  389. ----
  390. COMPLETE 0
  391. simple conn=joe,user=joe
  392. CREATE SOURCE webhook_text IN CLUSTER source_cluster FROM WEBHOOK BODY FORMAT TEXT;
  393. ----
  394. db error: ERROR: permission denied for SCHEMA "materialize.public"
  395. DETAIL: The 'joe' role needs CREATE privileges on SCHEMA "materialize.public"
  396. simple conn=child,user=child
  397. CREATE SOURCE webhook_text IN CLUSTER source_cluster FROM WEBHOOK BODY FORMAT TEXT;
  398. ----
  399. db error: ERROR: permission denied for SCHEMA "materialize.public"
  400. DETAIL: The 'child' role needs CREATE privileges on SCHEMA "materialize.public"
  401. simple conn=mz_system,user=mz_system
  402. REVOKE CREATECLUSTER ON SYSTEM FROM joe;
  403. ----
  404. COMPLETE 0
  405. simple conn=mz_system,user=mz_system
  406. REVOKE CREATE ON CLUSTER source_cluster FROM joe;
  407. ----
  408. COMPLETE 0
  409. # mz_support reading from progress source
  410. simple conn=mz_system,user=mz_system
  411. CREATE SOURCE s IN CLUSTER quickstart FROM LOAD GENERATOR COUNTER;
  412. ----
  413. COMPLETE 0
  414. simple conn=mz_support,user=mz_support
  415. SET CLUSTER TO "quickstart";
  416. ----
  417. COMPLETE 0
  418. simple conn=mz_support,user=mz_support
  419. SELECT * FROM s_progress LIMIT 0;
  420. ----
  421. COMPLETE 0
  422. simple conn=mz_support,user=mz_support
  423. SET CLUSTER TO mz_catalog_server;
  424. ----
  425. COMPLETE 0
  426. simple conn=mz_system,user=mz_system
  427. DROP SOURCE s;
  428. ----
  429. COMPLETE 0
  430. # CREATE SECRET
  431. simple conn=joe,user=joe
  432. CREATE SECRET se AS decode('c2VjcmV0Cg==', 'base64');
  433. ----
  434. db error: ERROR: permission denied for SCHEMA "materialize.public"
  435. DETAIL: The 'joe' role needs CREATE privileges on SCHEMA "materialize.public"
  436. simple conn=child,user=child
  437. CREATE SECRET se AS decode('c2VjcmV0Cg==', 'base64');
  438. ----
  439. db error: ERROR: permission denied for SCHEMA "materialize.public"
  440. DETAIL: The 'child' role needs CREATE privileges on SCHEMA "materialize.public"
  441. simple conn=mz_system,user=mz_system
  442. GRANT CREATE ON SCHEMA materialize.public TO joe;
  443. ----
  444. COMPLETE 0
  445. simple conn=joe,user=joe
  446. CREATE SECRET se AS decode('c2VjcmV0Cg==', 'base64');
  447. ----
  448. COMPLETE 0
  449. simple conn=child,user=child
  450. CREATE SECRET se1 AS decode('c2VjcmV0Cg==', 'base64');
  451. ----
  452. COMPLETE 0
  453. simple conn=mz_system,user=mz_system
  454. REVOKE CREATE ON SCHEMA materialize.public FROM joe;
  455. ----
  456. COMPLETE 0
  457. # CREATE TYPE
  458. simple conn=joe,user=joe
  459. CREATE TYPE ty AS (a text);
  460. ----
  461. db error: ERROR: permission denied for SCHEMA "materialize.public"
  462. DETAIL: The 'joe' role needs CREATE privileges on SCHEMA "materialize.public"
  463. simple conn=child,user=child
  464. CREATE TYPE ty AS (a text);
  465. ----
  466. db error: ERROR: permission denied for SCHEMA "materialize.public"
  467. DETAIL: The 'child' role needs CREATE privileges on SCHEMA "materialize.public"
  468. simple conn=mz_system,user=mz_system
  469. GRANT CREATE ON SCHEMA materialize.public TO joe;
  470. ----
  471. COMPLETE 0
  472. simple conn=joe,user=joe
  473. CREATE TYPE ty AS (a text);
  474. ----
  475. COMPLETE 0
  476. simple conn=child,user=child
  477. CREATE TYPE ty1 AS (a text);
  478. ----
  479. COMPLETE 0
  480. simple conn=mz_system,user=mz_system
  481. REVOKE CREATE ON SCHEMA materialize.public FROM joe;
  482. ----
  483. COMPLETE 0
  484. # CREATE TABLE
  485. simple conn=mz_system,user=mz_system
  486. REVOKE USAGE ON TYPE ty FROM PUBLIC;
  487. ----
  488. COMPLETE 0
  489. simple conn=mz_system,user=mz_system
  490. REVOKE USAGE ON TYPE ty FROM joe;
  491. ----
  492. COMPLETE 0
  493. simple conn=joe,user=joe
  494. CREATE TABLE t (a ty);
  495. ----
  496. db error: ERROR: permission denied for SCHEMA "materialize.public"
  497. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  498. simple conn=child,user=child
  499. CREATE TABLE t (a ty);
  500. ----
  501. db error: ERROR: permission denied for SCHEMA "materialize.public"
  502. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  503. simple conn=mz_system,user=mz_system
  504. GRANT USAGE ON SCHEMA materialize.public TO joe;
  505. ----
  506. COMPLETE 0
  507. simple conn=joe,user=joe
  508. CREATE TABLE t (a ty);
  509. ----
  510. db error: ERROR: permission denied for TYPE "materialize.public.ty"
  511. DETAIL: The 'joe' role needs USAGE privileges on TYPE "materialize.public.ty"
  512. simple conn=child,user=child
  513. CREATE TABLE t (a ty);
  514. ----
  515. db error: ERROR: permission denied for TYPE "materialize.public.ty"
  516. DETAIL: The 'child' role needs USAGE privileges on TYPE "materialize.public.ty"
  517. simple conn=mz_system,user=mz_system
  518. GRANT USAGE ON TYPE ty TO PUBLIC;
  519. ----
  520. COMPLETE 0
  521. simple conn=mz_system,user=mz_system
  522. GRANT USAGE ON TYPE ty TO joe;
  523. ----
  524. COMPLETE 0
  525. simple conn=joe,user=joe
  526. CREATE TABLE t (a ty);
  527. ----
  528. db error: ERROR: permission denied for SCHEMA "materialize.public"
  529. DETAIL: The 'joe' role needs CREATE privileges on SCHEMA "materialize.public"
  530. simple conn=child,user=child
  531. CREATE TABLE t (a ty);
  532. ----
  533. db error: ERROR: permission denied for SCHEMA "materialize.public"
  534. DETAIL: The 'child' role needs CREATE privileges on SCHEMA "materialize.public"
  535. simple conn=mz_system,user=mz_system
  536. GRANT CREATE ON SCHEMA materialize.public TO joe;
  537. ----
  538. COMPLETE 0
  539. simple conn=joe,user=joe
  540. CREATE TABLE t (a ty);
  541. ----
  542. COMPLETE 0
  543. simple conn=child,user=child
  544. CREATE TABLE t1 (a ty);
  545. ----
  546. COMPLETE 0
  547. simple conn=mz_system,user=mz_system
  548. REVOKE CREATE, USAGE ON SCHEMA materialize.public FROM joe;
  549. ----
  550. COMPLETE 0
  551. # CREATE VIEW
  552. simple conn=mz_system,user=mz_system
  553. REVOKE USAGE ON TYPE ty FROM PUBLIC;
  554. ----
  555. COMPLETE 0
  556. simple conn=mz_system,user=mz_system
  557. REVOKE USAGE ON TYPE ty FROM joe;
  558. ----
  559. COMPLETE 0
  560. simple conn=joe,user=joe
  561. CREATE VIEW v AS SELECT ROW(1)::ty;
  562. ----
  563. db error: ERROR: permission denied for SCHEMA "materialize.public"
  564. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  565. simple conn=child,user=child
  566. CREATE VIEW v AS SELECT ROW(1)::ty;
  567. ----
  568. db error: ERROR: permission denied for SCHEMA "materialize.public"
  569. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  570. simple conn=mz_system,user=mz_system
  571. GRANT USAGE ON SCHEMA materialize.public TO joe;
  572. ----
  573. COMPLETE 0
  574. simple conn=joe,user=joe
  575. CREATE VIEW v AS SELECT ROW(1)::ty;
  576. ----
  577. db error: ERROR: permission denied for TYPE "materialize.public.ty"
  578. DETAIL: The 'joe' role needs USAGE privileges on TYPE "materialize.public.ty"
  579. simple conn=child,user=child
  580. CREATE VIEW v AS SELECT ROW(1)::ty;
  581. ----
  582. db error: ERROR: permission denied for TYPE "materialize.public.ty"
  583. DETAIL: The 'child' role needs USAGE privileges on TYPE "materialize.public.ty"
  584. simple conn=mz_system,user=mz_system
  585. GRANT USAGE ON TYPE ty TO PUBLIC;
  586. ----
  587. COMPLETE 0
  588. simple conn=mz_system,user=mz_system
  589. GRANT USAGE ON TYPE ty TO joe;
  590. ----
  591. COMPLETE 0
  592. simple conn=joe,user=joe
  593. CREATE VIEW v AS SELECT ROW(1)::ty;
  594. ----
  595. db error: ERROR: permission denied for SCHEMA "materialize.public"
  596. DETAIL: The 'joe' role needs CREATE privileges on SCHEMA "materialize.public"
  597. simple conn=child,user=child
  598. CREATE VIEW v AS SELECT ROW(1)::ty;
  599. ----
  600. db error: ERROR: permission denied for SCHEMA "materialize.public"
  601. DETAIL: The 'child' role needs CREATE privileges on SCHEMA "materialize.public"
  602. simple conn=mz_system,user=mz_system
  603. GRANT CREATE ON SCHEMA materialize.public TO joe;
  604. ----
  605. COMPLETE 0
  606. simple conn=joe,user=joe
  607. CREATE VIEW v AS SELECT ROW(1)::ty;
  608. ----
  609. COMPLETE 0
  610. simple conn=child,user=child
  611. CREATE VIEW v1 AS SELECT ROW(1)::ty;
  612. ----
  613. COMPLETE 0
  614. simple conn=mz_system,user=mz_system
  615. REVOKE CREATE, USAGE ON SCHEMA materialize.public FROM joe;
  616. ----
  617. COMPLETE 0
  618. # CREATE MATERIALIZED VIEW
  619. simple conn=mz_system,user=mz_system
  620. REVOKE USAGE ON TYPE ty FROM PUBLIC;
  621. ----
  622. COMPLETE 0
  623. simple conn=mz_system,user=mz_system
  624. REVOKE USAGE ON TYPE ty FROM joe;
  625. ----
  626. COMPLETE 0
  627. simple conn=joe,user=joe
  628. CREATE MATERIALIZED VIEW mv AS SELECT ROW(1)::ty;
  629. ----
  630. db error: ERROR: permission denied for SCHEMA "materialize.public"
  631. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  632. simple conn=child,user=child
  633. CREATE MATERIALIZED VIEW mv AS SELECT ROW(1)::ty;
  634. ----
  635. db error: ERROR: permission denied for SCHEMA "materialize.public"
  636. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  637. simple conn=mz_system,user=mz_system
  638. GRANT USAGE ON SCHEMA materialize.public TO joe;
  639. ----
  640. COMPLETE 0
  641. simple conn=joe,user=joe
  642. CREATE MATERIALIZED VIEW mv AS SELECT ROW(1)::ty;
  643. ----
  644. db error: ERROR: permission denied for TYPE "materialize.public.ty"
  645. DETAIL: The 'joe' role needs USAGE privileges on TYPE "materialize.public.ty"
  646. simple conn=child,user=child
  647. CREATE MATERIALIZED VIEW mv AS SELECT ROW(1)::ty;
  648. ----
  649. db error: ERROR: permission denied for TYPE "materialize.public.ty"
  650. DETAIL: The 'child' role needs USAGE privileges on TYPE "materialize.public.ty"
  651. simple conn=mz_system,user=mz_system
  652. GRANT USAGE ON TYPE ty TO PUBLIC;
  653. ----
  654. COMPLETE 0
  655. simple conn=mz_system,user=mz_system
  656. GRANT USAGE ON TYPE ty TO joe;
  657. ----
  658. COMPLETE 0
  659. simple conn=joe,user=joe
  660. CREATE MATERIALIZED VIEW mv AS SELECT ROW(1)::ty;
  661. ----
  662. db error: ERROR: permission denied for SCHEMA "materialize.public"
  663. DETAIL: The 'joe' role needs CREATE privileges on SCHEMA "materialize.public"
  664. simple conn=child,user=child
  665. CREATE MATERIALIZED VIEW mv AS SELECT ROW(1)::ty;
  666. ----
  667. db error: ERROR: permission denied for SCHEMA "materialize.public"
  668. DETAIL: The 'child' role needs CREATE privileges on SCHEMA "materialize.public"
  669. simple conn=mz_system,user=mz_system
  670. GRANT CREATE ON SCHEMA materialize.public TO joe;
  671. ----
  672. COMPLETE 0
  673. simple conn=mz_system,user=mz_system
  674. REVOKE CREATE ON CLUSTER quickstart FROM joe;
  675. ----
  676. COMPLETE 0
  677. simple conn=joe,user=joe
  678. CREATE MATERIALIZED VIEW mv AS SELECT ROW(1)::ty;
  679. ----
  680. db error: ERROR: permission denied for CLUSTER "quickstart"
  681. DETAIL: The 'joe' role needs CREATE privileges on CLUSTER "quickstart"
  682. simple conn=child,user=child
  683. CREATE MATERIALIZED VIEW mv AS SELECT ROW(1)::ty;
  684. ----
  685. db error: ERROR: permission denied for CLUSTER "quickstart"
  686. DETAIL: The 'child' role needs CREATE privileges on CLUSTER "quickstart"
  687. simple conn=mz_system,user=mz_system
  688. GRANT CREATE ON CLUSTER quickstart TO joe;
  689. ----
  690. COMPLETE 0
  691. simple conn=joe,user=joe
  692. CREATE MATERIALIZED VIEW mv AS SELECT ROW(1)::ty;
  693. ----
  694. COMPLETE 0
  695. simple conn=child,user=child
  696. CREATE MATERIALIZED VIEW mv1 AS SELECT ROW(1)::ty;
  697. ----
  698. COMPLETE 0
  699. simple conn=mz_system,user=mz_system
  700. REVOKE CREATE, USAGE ON SCHEMA materialize.public FROM joe;
  701. ----
  702. COMPLETE 0
  703. simple conn=mz_system,user=mz_system
  704. REVOKE CREATE ON CLUSTER quickstart FROM joe;
  705. ----
  706. COMPLETE 0
  707. # CREATE INDEX
  708. simple conn=mz_system,user=mz_system
  709. REVOKE USAGE ON TYPE ty FROM PUBLIC;
  710. ----
  711. COMPLETE 0
  712. simple conn=mz_system,user=mz_system
  713. REVOKE USAGE ON TYPE ty FROM joe;
  714. ----
  715. COMPLETE 0
  716. simple conn=joe,user=joe
  717. CREATE INDEX i ON t (a::ty);
  718. ----
  719. db error: ERROR: permission denied for SCHEMA "materialize.public"
  720. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  721. simple conn=child,user=child
  722. CREATE INDEX i ON t (a::ty);
  723. ----
  724. db error: ERROR: permission denied for SCHEMA "materialize.public"
  725. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  726. simple conn=mz_system,user=mz_system
  727. GRANT USAGE ON SCHEMA materialize.public TO joe;
  728. ----
  729. COMPLETE 0
  730. simple conn=joe,user=joe
  731. CREATE INDEX i ON t (a::ty);
  732. ----
  733. db error: ERROR: permission denied for TYPE "materialize.public.ty"
  734. DETAIL: The 'joe' role needs USAGE privileges on TYPE "materialize.public.ty"
  735. simple conn=child,user=child
  736. CREATE INDEX i ON t (a::ty);
  737. ----
  738. db error: ERROR: permission denied for TYPE "materialize.public.ty"
  739. DETAIL: The 'child' role needs USAGE privileges on TYPE "materialize.public.ty"
  740. simple conn=mz_system,user=mz_system
  741. GRANT USAGE ON TYPE ty TO PUBLIC;
  742. ----
  743. COMPLETE 0
  744. simple conn=mz_system,user=mz_system
  745. GRANT USAGE ON TYPE ty TO joe;
  746. ----
  747. COMPLETE 0
  748. simple conn=joe,user=joe
  749. CREATE INDEX i ON t (a::ty);
  750. ----
  751. db error: ERROR: permission denied for SCHEMA "materialize.public"
  752. DETAIL: The 'joe' role needs CREATE privileges on SCHEMA "materialize.public"
  753. simple conn=child,user=child
  754. CREATE INDEX i ON t (a::ty);
  755. ----
  756. db error: ERROR: permission denied for SCHEMA "materialize.public"
  757. DETAIL: The 'child' role needs CREATE privileges on SCHEMA "materialize.public"
  758. simple conn=mz_system,user=mz_system
  759. GRANT CREATE ON SCHEMA materialize.public TO joe;
  760. ----
  761. COMPLETE 0
  762. simple conn=joe,user=joe
  763. CREATE INDEX i ON t (a::ty);
  764. ----
  765. db error: ERROR: permission denied for CLUSTER "quickstart"
  766. DETAIL: The 'joe' role needs CREATE privileges on CLUSTER "quickstart"
  767. simple conn=child,user=child
  768. CREATE INDEX i ON t (a::ty);
  769. ----
  770. db error: ERROR: permission denied for CLUSTER "quickstart"
  771. DETAIL: The 'child' role needs CREATE privileges on CLUSTER "quickstart"
  772. simple conn=mz_system,user=mz_system
  773. GRANT CREATE ON CLUSTER quickstart TO joe;
  774. ----
  775. COMPLETE 0
  776. simple conn=joe,user=joe
  777. CREATE INDEX i ON t (a::ty);
  778. ----
  779. COMPLETE 0
  780. simple conn=child,user=child
  781. CREATE INDEX i1 ON t (a::ty);
  782. ----
  783. COMPLETE 0
  784. simple conn=mz_system,user=mz_system
  785. REVOKE CREATE, USAGE ON SCHEMA materialize.public FROM joe;
  786. ----
  787. COMPLETE 0
  788. simple conn=mz_system,user=mz_system
  789. REVOKE CREATE ON CLUSTER quickstart FROM joe;
  790. ----
  791. COMPLETE 0
  792. # DROP CONNECTION
  793. simple conn=joe,user=joe
  794. DROP CONNECTION conn;
  795. ----
  796. db error: ERROR: permission denied for SCHEMA "materialize.public"
  797. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  798. simple conn=child,user=child
  799. DROP CONNECTION conn1;
  800. ----
  801. db error: ERROR: permission denied for SCHEMA "materialize.public"
  802. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  803. simple conn=mz_system,user=mz_system
  804. GRANT USAGE ON SCHEMA materialize.public TO joe;
  805. ----
  806. COMPLETE 0
  807. simple conn=joe,user=joe
  808. DROP CONNECTION conn;
  809. ----
  810. COMPLETE 0
  811. simple conn=child,user=child
  812. DROP CONNECTION conn1;
  813. ----
  814. COMPLETE 0
  815. simple conn=mz_system,user=mz_system
  816. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  817. ----
  818. COMPLETE 0
  819. # DROP DATABASE
  820. simple conn=joe,user=joe
  821. DROP DATABASE d;
  822. ----
  823. COMPLETE 0
  824. simple conn=child,user=child
  825. DROP DATABASE d1;
  826. ----
  827. COMPLETE 0
  828. # DROP CLUSTER
  829. simple conn=joe,user=joe
  830. DROP CLUSTER c;
  831. ----
  832. COMPLETE 0
  833. simple conn=child,user=child
  834. DROP CLUSTER c1;
  835. ----
  836. COMPLETE 0
  837. # DROP SCHEMA
  838. simple conn=joe,user=joe
  839. DROP SCHEMA sch;
  840. ----
  841. db error: ERROR: permission denied for DATABASE "materialize"
  842. DETAIL: The 'joe' role needs USAGE privileges on DATABASE "materialize"
  843. simple conn=child,user=child
  844. DROP SCHEMA sch1;
  845. ----
  846. db error: ERROR: permission denied for DATABASE "materialize"
  847. DETAIL: The 'child' role needs USAGE privileges on DATABASE "materialize"
  848. simple conn=mz_system,user=mz_system
  849. GRANT USAGE ON DATABASE materialize TO joe;
  850. ----
  851. COMPLETE 0
  852. simple conn=joe,user=joe
  853. DROP SCHEMA sch;
  854. ----
  855. COMPLETE 0
  856. simple conn=child,user=child
  857. DROP SCHEMA sch1;
  858. ----
  859. COMPLETE 0
  860. simple conn=mz_system,user=mz_system
  861. REVOKE USAGE ON DATABASE materialize FROM joe;
  862. ----
  863. COMPLETE 0
  864. # DROP CLUSTER REPLICA
  865. simple conn=joe,user=joe
  866. DROP CLUSTER REPLICA clus.r2;
  867. ----
  868. COMPLETE 0
  869. simple conn=child,user=child
  870. DROP CLUSTER REPLICA clus.r3;
  871. ----
  872. COMPLETE 0
  873. simple conn=mz_system,user=mz_system
  874. DROP CLUSTER clus;
  875. ----
  876. COMPLETE 0
  877. # DROP ROLE
  878. simple conn=joe,user=joe
  879. DROP ROLE r;
  880. ----
  881. db error: ERROR: permission denied for SYSTEM
  882. DETAIL: The 'joe' role needs CREATEROLE privileges on SYSTEM
  883. simple conn=child,user=child
  884. DROP ROLE r1;
  885. ----
  886. db error: ERROR: permission denied for SYSTEM
  887. DETAIL: The 'child' role needs CREATEROLE privileges on SYSTEM
  888. simple conn=mz_system,user=mz_system
  889. GRANT CREATEROLE ON SYSTEM TO joe;
  890. ----
  891. COMPLETE 0
  892. simple conn=joe,user=joe
  893. DROP ROLE r;
  894. ----
  895. COMPLETE 0
  896. simple conn=child,user=child
  897. DROP ROLE r1;
  898. ----
  899. COMPLETE 0
  900. # DROP SOURCE
  901. simple conn=joe,user=joe
  902. DROP SOURCE s1;
  903. ----
  904. db error: ERROR: permission denied for SCHEMA "materialize.public"
  905. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  906. simple conn=joe,user=joe
  907. DROP SOURCE s2;
  908. ----
  909. db error: ERROR: permission denied for SCHEMA "materialize.public"
  910. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  911. simple conn=child,user=child
  912. DROP SOURCE s4;
  913. ----
  914. db error: ERROR: permission denied for SCHEMA "materialize.public"
  915. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  916. simple conn=mz_system,user=mz_system
  917. GRANT USAGE ON SCHEMA materialize.public TO joe;
  918. ----
  919. COMPLETE 0
  920. simple conn=joe,user=joe
  921. DROP SOURCE s1
  922. ----
  923. COMPLETE 0
  924. simple conn=joe,user=joe
  925. DROP SOURCE s2
  926. ----
  927. COMPLETE 0
  928. simple conn=child,user=child
  929. DROP SOURCE s4
  930. ----
  931. COMPLETE 0
  932. simple conn=mz_system,user=mz_system
  933. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  934. ----
  935. COMPLETE 0
  936. # DROP SECRET
  937. simple conn=joe,user=joe
  938. DROP SECRET se;
  939. ----
  940. db error: ERROR: permission denied for SCHEMA "materialize.public"
  941. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  942. simple conn=child,user=child
  943. DROP SECRET se1;
  944. ----
  945. db error: ERROR: permission denied for SCHEMA "materialize.public"
  946. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  947. simple conn=mz_system,user=mz_system
  948. GRANT USAGE ON SCHEMA materialize.public TO joe;
  949. ----
  950. COMPLETE 0
  951. simple conn=joe,user=joe
  952. DROP SECRET se;
  953. ----
  954. COMPLETE 0
  955. simple conn=child,user=child
  956. DROP SECRET se1;
  957. ----
  958. COMPLETE 0
  959. simple conn=mz_system,user=mz_system
  960. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  961. ----
  962. COMPLETE 0
  963. # DROP INDEX
  964. simple conn=joe,user=joe
  965. DROP INDEX i;
  966. ----
  967. db error: ERROR: permission denied for SCHEMA "materialize.public"
  968. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  969. simple conn=child,user=child
  970. DROP INDEX i1;
  971. ----
  972. db error: ERROR: permission denied for SCHEMA "materialize.public"
  973. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  974. simple conn=mz_system,user=mz_system
  975. GRANT USAGE ON SCHEMA materialize.public TO joe;
  976. ----
  977. COMPLETE 0
  978. simple conn=joe,user=joe
  979. DROP INDEX i;
  980. ----
  981. COMPLETE 0
  982. simple conn=child,user=child
  983. DROP INDEX i1;
  984. ----
  985. COMPLETE 0
  986. simple conn=mz_system,user=mz_system
  987. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  988. ----
  989. COMPLETE 0
  990. # DROP TABLE
  991. simple conn=joe,user=joe
  992. DROP TABLE t;
  993. ----
  994. db error: ERROR: permission denied for SCHEMA "materialize.public"
  995. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  996. simple conn=child,user=child
  997. DROP TABLE t1;
  998. ----
  999. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1000. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1001. simple conn=mz_system,user=mz_system
  1002. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1003. ----
  1004. COMPLETE 0
  1005. simple conn=joe,user=joe
  1006. DROP TABLE t;
  1007. ----
  1008. COMPLETE 0
  1009. simple conn=child,user=child
  1010. DROP TABLE t1;
  1011. ----
  1012. COMPLETE 0
  1013. simple conn=mz_system,user=mz_system
  1014. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1015. ----
  1016. COMPLETE 0
  1017. # DROP VIEW
  1018. simple conn=joe,user=joe
  1019. DROP VIEW v;
  1020. ----
  1021. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1022. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1023. simple conn=child,user=child
  1024. DROP VIEW v1;
  1025. ----
  1026. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1027. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1028. simple conn=mz_system,user=mz_system
  1029. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1030. ----
  1031. COMPLETE 0
  1032. simple conn=joe,user=joe
  1033. DROP VIEW v;
  1034. ----
  1035. COMPLETE 0
  1036. simple conn=child,user=child
  1037. DROP VIEW v1;
  1038. ----
  1039. COMPLETE 0
  1040. simple conn=mz_system,user=mz_system
  1041. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1042. ----
  1043. COMPLETE 0
  1044. # DROP MATERIALIZED VIEW
  1045. simple conn=joe,user=joe
  1046. DROP MATERIALIZED VIEW mv;
  1047. ----
  1048. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1049. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1050. simple conn=child,user=child
  1051. DROP MATERIALIZED VIEW mv1;
  1052. ----
  1053. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1054. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1055. simple conn=mz_system,user=mz_system
  1056. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1057. ----
  1058. COMPLETE 0
  1059. simple conn=joe,user=joe
  1060. DROP MATERIALIZED VIEW mv;
  1061. ----
  1062. COMPLETE 0
  1063. simple conn=child,user=child
  1064. DROP MATERIALIZED VIEW mv1;
  1065. ----
  1066. COMPLETE 0
  1067. simple conn=mz_system,user=mz_system
  1068. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1069. ----
  1070. COMPLETE 0
  1071. # DROP TYPE
  1072. simple conn=joe,user=joe
  1073. DROP TYPE ty;
  1074. ----
  1075. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1076. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1077. simple conn=child,user=child
  1078. DROP TYPE ty1;
  1079. ----
  1080. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1081. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1082. simple conn=mz_system,user=mz_system
  1083. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1084. ----
  1085. COMPLETE 0
  1086. simple conn=joe,user=joe
  1087. DROP TYPE ty;
  1088. ----
  1089. COMPLETE 0
  1090. simple conn=child,user=child
  1091. DROP TYPE ty1;
  1092. ----
  1093. COMPLETE 0
  1094. simple conn=mz_system,user=mz_system
  1095. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1096. ----
  1097. COMPLETE 0
  1098. # SHOW CREATE
  1099. simple conn=mz_system,user=mz_system
  1100. CREATE TABLE t (a INT);
  1101. ----
  1102. COMPLETE 0
  1103. simple conn=joe,user=joe
  1104. SHOW CREATE TABLE t;
  1105. ----
  1106. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1107. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1108. simple conn=child,user=child
  1109. SHOW CREATE TABLE t;
  1110. ----
  1111. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1112. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1113. simple conn=mz_system,user=mz_system
  1114. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1115. ----
  1116. COMPLETE 0
  1117. simple conn=joe,user=joe
  1118. SHOW CREATE TABLE t;
  1119. ----
  1120. materialize.public.t,CREATE TABLE materialize.public.t (a pg_catalog.int4);
  1121. COMPLETE 1
  1122. simple conn=child,user=child
  1123. SHOW CREATE TABLE t;
  1124. ----
  1125. materialize.public.t,CREATE TABLE materialize.public.t (a pg_catalog.int4);
  1126. COMPLETE 1
  1127. simple conn=mz_system,user=mz_system
  1128. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1129. ----
  1130. COMPLETE 0
  1131. simple conn=mz_system,user=mz_system
  1132. DROP TABLE t;
  1133. ----
  1134. COMPLETE 0
  1135. simple conn=mz_system,user=mz_system
  1136. CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (URL 'https://google.com') WITH (VALIDATE = false);
  1137. ----
  1138. COMPLETE 0
  1139. simple conn=joe,user=joe
  1140. SHOW CREATE CONNECTION csr_conn;
  1141. ----
  1142. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1143. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1144. simple conn=child,user=child
  1145. SHOW CREATE CONNECTION csr_conn;
  1146. ----
  1147. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1148. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1149. simple conn=mz_system,user=mz_system
  1150. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1151. ----
  1152. COMPLETE 0
  1153. simple conn=joe,user=joe
  1154. SHOW CREATE CONNECTION csr_conn;
  1155. ----
  1156. materialize.public.csr_conn,CREATE CONNECTION materialize.public.csr_conn TO CONFLUENT SCHEMA REGISTRY (URL = 'https://google.com');
  1157. COMPLETE 1
  1158. simple conn=child,user=child
  1159. SHOW CREATE CONNECTION csr_conn;
  1160. ----
  1161. materialize.public.csr_conn,CREATE CONNECTION materialize.public.csr_conn TO CONFLUENT SCHEMA REGISTRY (URL = 'https://google.com');
  1162. COMPLETE 1
  1163. simple conn=mz_system,user=mz_system
  1164. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1165. ----
  1166. COMPLETE 0
  1167. simple conn=mz_system,user=mz_system
  1168. DROP CONNECTION csr_conn;
  1169. ----
  1170. COMPLETE 0
  1171. # SELECT
  1172. ## Table
  1173. simple conn=mz_system,user=mz_system
  1174. CREATE TYPE ty AS (a text);
  1175. ----
  1176. COMPLETE 0
  1177. simple conn=mz_system,user=mz_system
  1178. REVOKE USAGE ON TYPE ty FROM PUBLIC;
  1179. ----
  1180. COMPLETE 0
  1181. simple conn=mz_system,user=mz_system
  1182. CREATE TABLE t (a ty);
  1183. ----
  1184. COMPLETE 0
  1185. simple conn=joe,user=joe
  1186. SELECT a::ty FROM t;
  1187. ----
  1188. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1189. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1190. simple conn=child,user=child
  1191. SELECT a::ty FROM t;
  1192. ----
  1193. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1194. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1195. simple conn=mz_system,user=mz_system
  1196. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1197. ----
  1198. COMPLETE 0
  1199. simple conn=mz_system,user=mz_system
  1200. GRANT USAGE ON TYPE ty TO joe;
  1201. ----
  1202. COMPLETE 0
  1203. simple conn=joe,user=joe
  1204. SELECT a::ty FROM t;
  1205. ----
  1206. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1207. DETAIL: The 'joe' role needs SELECT privileges on TABLE "materialize.public.t"
  1208. simple conn=child,user=child
  1209. SELECT a::ty FROM t;
  1210. ----
  1211. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1212. DETAIL: The 'child' role needs SELECT privileges on TABLE "materialize.public.t"
  1213. simple conn=mz_system,user=mz_system
  1214. GRANT SELECT ON TABLE t TO joe;
  1215. ----
  1216. COMPLETE 0
  1217. simple conn=joe,user=joe
  1218. SELECT a::ty FROM t;
  1219. ----
  1220. db error: ERROR: permission denied for CLUSTER "quickstart"
  1221. DETAIL: The 'joe' role needs USAGE privileges on CLUSTER "quickstart"
  1222. simple conn=child,user=child
  1223. SELECT a::ty FROM t;
  1224. ----
  1225. db error: ERROR: permission denied for CLUSTER "quickstart"
  1226. DETAIL: The 'child' role needs USAGE privileges on CLUSTER "quickstart"
  1227. simple conn=mz_system,user=mz_system
  1228. GRANT USAGE ON CLUSTER quickstart TO joe;
  1229. ----
  1230. COMPLETE 0
  1231. simple conn=joe,user=joe
  1232. SELECT a::ty FROM t;
  1233. ----
  1234. COMPLETE 0
  1235. simple conn=child,user=child
  1236. SELECT a::ty FROM t;
  1237. ----
  1238. COMPLETE 0
  1239. simple conn=mz_system,user=mz_system
  1240. REVOKE SELECT ON TABLE t FROM joe;
  1241. ----
  1242. COMPLETE 0
  1243. simple conn=mz_system,user=mz_system
  1244. REVOKE USAGE ON TYPE ty FROM joe;
  1245. ----
  1246. COMPLETE 0
  1247. simple conn=mz_system,user=mz_system
  1248. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1249. ----
  1250. COMPLETE 0
  1251. simple conn=mz_system,user=mz_system
  1252. REVOKE USAGE ON CLUSTER quickstart FROM joe;
  1253. ----
  1254. COMPLETE 0
  1255. simple conn=mz_system,user=mz_system
  1256. DROP TABLE t;
  1257. ----
  1258. COMPLETE 0
  1259. simple conn=mz_system,user=mz_system
  1260. DROP TYPE ty;
  1261. ----
  1262. COMPLETE 0
  1263. ## View
  1264. simple conn=mz_system,user=mz_system
  1265. CREATE ROLE view_owner;
  1266. ----
  1267. COMPLETE 0
  1268. simple conn=mz_system,user=mz_system
  1269. CREATE TABLE t (a INT);
  1270. ----
  1271. COMPLETE 0
  1272. simple conn=mz_system,user=mz_system
  1273. GRANT CREATE ON SCHEMA materialize.public TO view_owner;
  1274. ----
  1275. COMPLETE 0
  1276. simple conn=view_owner,user=view_owner
  1277. CREATE VIEW v AS SELECT * FROM t;
  1278. ----
  1279. COMPLETE 0
  1280. simple conn=joe,user=joe
  1281. SELECT * FROM v;
  1282. ----
  1283. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1284. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1285. simple conn=child,user=child
  1286. SELECT * FROM v;
  1287. ----
  1288. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1289. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1290. simple conn=mz_system,user=mz_system
  1291. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1292. ----
  1293. COMPLETE 0
  1294. simple conn=joe,user=joe
  1295. SELECT * FROM v;
  1296. ----
  1297. db error: ERROR: permission denied for VIEW "materialize.public.v"
  1298. DETAIL: The 'joe' role needs SELECT privileges on VIEW "materialize.public.v"
  1299. simple conn=child,user=child
  1300. SELECT * FROM v;
  1301. ----
  1302. db error: ERROR: permission denied for VIEW "materialize.public.v"
  1303. DETAIL: The 'child' role needs SELECT privileges on VIEW "materialize.public.v"
  1304. simple conn=mz_system,user=mz_system
  1305. GRANT SELECT ON TABLE v TO joe;
  1306. ----
  1307. COMPLETE 0
  1308. simple conn=joe,user=joe
  1309. SELECT * FROM v;
  1310. ----
  1311. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1312. DETAIL: The 'view_owner' role needs USAGE privileges on SCHEMA "materialize.public"
  1313. simple conn=child,user=child
  1314. SELECT * FROM v;
  1315. ----
  1316. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1317. DETAIL: The 'view_owner' role needs USAGE privileges on SCHEMA "materialize.public"
  1318. simple conn=mz_system,user=mz_system
  1319. GRANT USAGE ON SCHEMA materialize.public TO view_owner;
  1320. ----
  1321. COMPLETE 0
  1322. simple conn=joe,user=joe
  1323. SELECT * FROM v;
  1324. ----
  1325. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1326. DETAIL: The 'view_owner' role needs SELECT privileges on TABLE "materialize.public.t"
  1327. simple conn=child,user=child
  1328. SELECT * FROM v;
  1329. ----
  1330. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1331. DETAIL: The 'view_owner' role needs SELECT privileges on TABLE "materialize.public.t"
  1332. simple conn=mz_system,user=mz_system
  1333. GRANT SELECT ON TABLE t TO view_owner;
  1334. ----
  1335. COMPLETE 0
  1336. simple conn=joe,user=joe
  1337. SELECT * FROM v;
  1338. ----
  1339. db error: ERROR: permission denied for CLUSTER "quickstart"
  1340. DETAIL: The 'joe' role needs USAGE privileges on CLUSTER "quickstart"
  1341. simple conn=child,user=child
  1342. SELECT * FROM v;
  1343. ----
  1344. db error: ERROR: permission denied for CLUSTER "quickstart"
  1345. DETAIL: The 'child' role needs USAGE privileges on CLUSTER "quickstart"
  1346. simple conn=mz_system,user=mz_system
  1347. GRANT USAGE ON CLUSTER quickstart TO joe;
  1348. ----
  1349. COMPLETE 0
  1350. simple conn=joe,user=joe
  1351. SELECT * FROM v;
  1352. ----
  1353. COMPLETE 0
  1354. simple conn=child,user=child
  1355. SELECT * FROM v;
  1356. ----
  1357. COMPLETE 0
  1358. simple conn=mz_system,user=mz_system
  1359. REVOKE SELECT ON TABLE t FROM view_owner;
  1360. ----
  1361. COMPLETE 0
  1362. simple conn=mz_system,user=mz_system
  1363. REVOKE SELECT ON TABLE v FROM joe;
  1364. ----
  1365. COMPLETE 0
  1366. simple conn=mz_system,user=mz_system
  1367. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1368. ----
  1369. COMPLETE 0
  1370. simple conn=mz_system,user=mz_system
  1371. REVOKE USAGE, CREATE ON SCHEMA materialize.public FROM view_owner;
  1372. ----
  1373. COMPLETE 0
  1374. simple conn=mz_system,user=mz_system
  1375. REVOKE USAGE ON CLUSTER quickstart FROM joe;
  1376. ----
  1377. COMPLETE 0
  1378. simple conn=mz_system,user=mz_system
  1379. DROP VIEW v;
  1380. ----
  1381. COMPLETE 0
  1382. simple conn=mz_system,user=mz_system
  1383. DROP TABLE t;
  1384. ----
  1385. COMPLETE 0
  1386. simple conn=mz_system,user=mz_system
  1387. DROP ROLE view_owner;
  1388. ----
  1389. COMPLETE 0
  1390. # SHOW
  1391. simple conn=joe,user=joe
  1392. SHOW TABLES
  1393. ----
  1394. COMPLETE 0
  1395. simple conn=child,user=child
  1396. SHOW TABLES
  1397. ----
  1398. COMPLETE 0
  1399. # EXPLAIN
  1400. ## Table
  1401. simple conn=mz_system,user=mz_system
  1402. CREATE TYPE ty AS (a text);
  1403. ----
  1404. COMPLETE 0
  1405. simple conn=mz_system,user=mz_system
  1406. REVOKE USAGE ON TYPE ty FROM PUBLIC;
  1407. ----
  1408. COMPLETE 0
  1409. simple conn=mz_system,user=mz_system
  1410. CREATE TABLE t (a ty);
  1411. ----
  1412. COMPLETE 0
  1413. simple conn=joe,user=joe
  1414. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR SELECT a::ty FROM t;
  1415. ----
  1416. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1417. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1418. simple conn=child,user=child
  1419. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR SELECT a::ty FROM t;
  1420. ----
  1421. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1422. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1423. simple conn=mz_system,user=mz_system
  1424. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1425. ----
  1426. COMPLETE 0
  1427. simple conn=mz_system,user=mz_system
  1428. GRANT USAGE ON TYPE ty TO joe;
  1429. ----
  1430. COMPLETE 0
  1431. simple multiline,conn=joe,user=joe
  1432. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR SELECT a::ty FROM t;
  1433. ----
  1434. Explained Query:
  1435. ReadStorage materialize.public.t
  1436. Source materialize.public.t
  1437. Target cluster: quickstart
  1438. EOF
  1439. COMPLETE 1
  1440. simple multiline,conn=child,user=child
  1441. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR SELECT a::ty FROM t;
  1442. ----
  1443. Explained Query:
  1444. ReadStorage materialize.public.t
  1445. Source materialize.public.t
  1446. Target cluster: quickstart
  1447. EOF
  1448. COMPLETE 1
  1449. simple conn=mz_system,user=mz_system
  1450. REVOKE USAGE ON TYPE ty FROM joe;
  1451. ----
  1452. COMPLETE 0
  1453. simple conn=mz_system,user=mz_system
  1454. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1455. ----
  1456. COMPLETE 0
  1457. simple conn=mz_system,user=mz_system
  1458. DROP TABLE t;
  1459. ----
  1460. COMPLETE 0
  1461. simple conn=mz_system,user=mz_system
  1462. DROP TYPE ty;
  1463. ----
  1464. COMPLETE 0
  1465. ## Explain schema
  1466. simple conn=mz_system,user=mz_system
  1467. CREATE TYPE ty AS (a text);
  1468. ----
  1469. COMPLETE 0
  1470. simple conn=mz_system,user=mz_system
  1471. REVOKE USAGE ON TYPE ty FROM PUBLIC;
  1472. ----
  1473. COMPLETE 0
  1474. simple conn=mz_system,user=mz_system
  1475. CREATE TABLE t (a ty);
  1476. ----
  1477. COMPLETE 0
  1478. simple conn=mz_system,user=mz_system
  1479. CREATE CONNECTION kafka_conn TO KAFKA (BROKER 'localhost:9092', SECURITY PROTOCOL PLAINTEXT) WITH (VALIDATE = false);
  1480. ----
  1481. COMPLETE 0
  1482. simple conn=mz_system,user=mz_system
  1483. CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (URL 'https://google.com') WITH (VALIDATE = false);
  1484. ----
  1485. COMPLETE 0
  1486. simple conn=joe,user=joe
  1487. EXPLAIN VALUE SCHEMA FOR CREATE SINK sink FROM t INTO KAFKA CONNECTION kafka_conn (TOPIC 'topic') KEY (a) NOT ENFORCED FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn (DOC ON COLUMN ty.a = 'comment') ENVELOPE UPSERT;
  1488. ----
  1489. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1490. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1491. simple conn=mz_system,user=mz_system
  1492. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1493. ----
  1494. COMPLETE 0
  1495. simple multiline,conn=joe,user=joe
  1496. EXPLAIN VALUE SCHEMA FOR CREATE SINK sink FROM t INTO KAFKA CONNECTION kafka_conn (TOPIC 'topic') KEY (a) NOT ENFORCED FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn (DOC ON COLUMN ty.a = 'comment') ENVELOPE UPSERT;
  1497. ----
  1498. {
  1499. "type": "record",
  1500. "name": "envelope",
  1501. "fields": [
  1502. {
  1503. "name": "a",
  1504. "type": [
  1505. "null",
  1506. {
  1507. "type": "record",
  1508. "name": "record0",
  1509. "namespace": "com.materialize.sink",
  1510. "fields": [
  1511. {
  1512. "name": "a",
  1513. "type": [
  1514. "null",
  1515. "string"
  1516. ],
  1517. "doc": "comment"
  1518. }
  1519. ]
  1520. }
  1521. ]
  1522. }
  1523. ]
  1524. }
  1525. EOF
  1526. COMPLETE 1
  1527. simple conn=mz_system,user=mz_system
  1528. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1529. ----
  1530. COMPLETE 0
  1531. simple conn=mz_system,user=mz_system
  1532. DROP TABLE t;
  1533. ----
  1534. COMPLETE 0
  1535. simple conn=mz_system,user=mz_system
  1536. DROP TYPE ty;
  1537. ----
  1538. COMPLETE 0
  1539. simple conn=mz_system,user=mz_system
  1540. DROP CONNECTION kafka_conn;
  1541. ----
  1542. COMPLETE 0
  1543. simple conn=mz_system,user=mz_system
  1544. DROP CONNECTION csr_conn;
  1545. ----
  1546. COMPLETE 0
  1547. ## View
  1548. simple conn=mz_system,user=mz_system
  1549. CREATE ROLE view_owner;
  1550. ----
  1551. COMPLETE 0
  1552. simple conn=mz_system,user=mz_system
  1553. CREATE TABLE t (a INT);
  1554. ----
  1555. COMPLETE 0
  1556. simple conn=mz_system,user=mz_system
  1557. GRANT CREATE ON SCHEMA materialize.public TO view_owner;
  1558. ----
  1559. COMPLETE 0
  1560. simple conn=view_owner1,user=view_owner
  1561. CREATE VIEW v AS SELECT * FROM t;
  1562. ----
  1563. COMPLETE 0
  1564. simple conn=joe,user=joe
  1565. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR SELECT * FROM v;
  1566. ----
  1567. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1568. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1569. simple conn=child,user=child
  1570. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR SELECT * FROM v;
  1571. ----
  1572. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1573. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1574. simple conn=mz_system,user=mz_system
  1575. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1576. ----
  1577. COMPLETE 0
  1578. simple multiline,conn=joe,user=joe
  1579. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR SELECT * FROM v;
  1580. ----
  1581. Explained Query:
  1582. ReadStorage materialize.public.t
  1583. Source materialize.public.t
  1584. Target cluster: quickstart
  1585. EOF
  1586. COMPLETE 1
  1587. simple multiline,conn=child,user=child
  1588. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR SELECT * FROM v;
  1589. ----
  1590. Explained Query:
  1591. ReadStorage materialize.public.t
  1592. Source materialize.public.t
  1593. Target cluster: quickstart
  1594. EOF
  1595. COMPLETE 1
  1596. simple conn=mz_system,user=mz_system
  1597. REVOKE CREATE ON SCHEMA materialize.public FROM view_owner;
  1598. ----
  1599. COMPLETE 0
  1600. simple conn=mz_system,user=mz_system
  1601. DROP VIEW v;
  1602. ----
  1603. COMPLETE 0
  1604. simple conn=mz_system,user=mz_system
  1605. DROP TABLE t;
  1606. ----
  1607. COMPLETE 0
  1608. simple conn=mz_system,user=mz_system
  1609. DROP ROLE view_owner;
  1610. ----
  1611. COMPLETE 0
  1612. ## EXPLAIN MATERIALIZED VIEW
  1613. ### We use the materialize role for these tests because we need the multiline functionality
  1614. simple conn=mz_system,user=mz_system
  1615. REVOKE USAGE ON SCHEMA materialize.public FROM materialize;
  1616. ----
  1617. COMPLETE 0
  1618. simple conn=mz_system,user=mz_system
  1619. CREATE MATERIALIZED VIEW mv IN CLUSTER quickstart AS SELECT 1
  1620. ----
  1621. COMPLETE 0
  1622. query error permission denied for SCHEMA "materialize.public"
  1623. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR MATERIALIZED VIEW mv;
  1624. simple conn=mz_system,user=mz_system
  1625. GRANT USAGE ON SCHEMA materialize.public TO materialize;
  1626. ----
  1627. COMPLETE 0
  1628. query T multiline
  1629. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR MATERIALIZED VIEW mv;
  1630. ----
  1631. materialize.public.mv:
  1632. Constant
  1633. - (1)
  1634. Target cluster: quickstart
  1635. EOF
  1636. simple conn=mz_system,user=mz_system
  1637. DROP MATERIALIZED VIEW mv
  1638. ----
  1639. COMPLETE 0
  1640. ## EXPLAIN INDEX
  1641. ### We use the materialize role for these tests because we need the multiline functionality
  1642. simple conn=mz_system,user=mz_system
  1643. REVOKE USAGE ON SCHEMA materialize.public FROM materialize;
  1644. ----
  1645. COMPLETE 0
  1646. simple conn=mz_system,user=mz_system
  1647. CREATE TABLE t (a INT)
  1648. ----
  1649. COMPLETE 0
  1650. simple conn=mz_system,user=mz_system
  1651. CREATE INDEX i IN CLUSTER quickstart ON t(a)
  1652. ----
  1653. COMPLETE 0
  1654. query error permission denied for SCHEMA "materialize.public"
  1655. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR INDEX i;
  1656. simple conn=mz_system,user=mz_system
  1657. GRANT USAGE ON SCHEMA materialize.public TO materialize;
  1658. ----
  1659. COMPLETE 0
  1660. query T multiline
  1661. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR INDEX i;
  1662. ----
  1663. materialize.public.i:
  1664. ArrangeBy keys=[[#0{a}]]
  1665. ReadStorage materialize.public.t
  1666. Source materialize.public.t
  1667. Target cluster: quickstart
  1668. EOF
  1669. simple conn=mz_system,user=mz_system
  1670. DROP INDEX i
  1671. ----
  1672. COMPLETE 0
  1673. simple conn=mz_system,user=mz_system
  1674. DROP TABLE t
  1675. ----
  1676. COMPLETE 0
  1677. # INSERT
  1678. simple conn=mz_system,user=mz_system
  1679. CREATE TABLE t (a INT);
  1680. ----
  1681. COMPLETE 0
  1682. simple conn=joe,user=joe
  1683. INSERT INTO t VALUES (1);
  1684. ----
  1685. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1686. DETAIL: The 'joe' role needs INSERT privileges on TABLE "materialize.public.t"
  1687. simple conn=child,user=child
  1688. INSERT INTO t VALUES (1);
  1689. ----
  1690. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1691. DETAIL: The 'child' role needs INSERT privileges on TABLE "materialize.public.t"
  1692. simple conn=mz_system,user=mz_system
  1693. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1694. ----
  1695. COMPLETE 0
  1696. simple conn=joe,user=joe
  1697. INSERT INTO t VALUES (1);
  1698. ----
  1699. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1700. DETAIL: The 'joe' role needs INSERT privileges on TABLE "materialize.public.t"
  1701. simple conn=child,user=child
  1702. INSERT INTO t VALUES (1);
  1703. ----
  1704. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1705. DETAIL: The 'child' role needs INSERT privileges on TABLE "materialize.public.t"
  1706. simple conn=mz_system,user=mz_system
  1707. GRANT INSERT ON TABLE t TO joe;
  1708. ----
  1709. COMPLETE 0
  1710. # TODO(jkosh44) We're not smart enough to know that this doesn't require a cluster
  1711. simple conn=joe,user=joe
  1712. INSERT INTO t VALUES (1);
  1713. ----
  1714. db error: ERROR: permission denied for CLUSTER "quickstart"
  1715. DETAIL: The 'joe' role needs USAGE privileges on CLUSTER "quickstart"
  1716. simple conn=child,user=child
  1717. INSERT INTO t VALUES (1);
  1718. ----
  1719. db error: ERROR: permission denied for CLUSTER "quickstart"
  1720. DETAIL: The 'child' role needs USAGE privileges on CLUSTER "quickstart"
  1721. simple conn=mz_system,user=mz_system
  1722. GRANT USAGE ON CLUSTER quickstart TO joe;
  1723. ----
  1724. COMPLETE 0
  1725. simple conn=joe,user=joe
  1726. INSERT INTO t VALUES (1);
  1727. ----
  1728. COMPLETE 1
  1729. simple conn=child,user=child
  1730. INSERT INTO t VALUES (1);
  1731. ----
  1732. COMPLETE 1
  1733. simple conn=mz_system,user=mz_system
  1734. REVOKE INSERT ON TABLE t FROM joe;
  1735. ----
  1736. COMPLETE 0
  1737. simple conn=mz_system,user=mz_system
  1738. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1739. ----
  1740. COMPLETE 0
  1741. simple conn=mz_system,user=mz_system
  1742. REVOKE USAGE ON CLUSTER quickstart FROM joe;
  1743. ----
  1744. COMPLETE 0
  1745. simple conn=mz_system,user=mz_system
  1746. DROP TABLE t;
  1747. ----
  1748. COMPLETE 0
  1749. # INSERT INTO .. SELECT
  1750. simple conn=mz_system,user=mz_system
  1751. CREATE TABLE t (a INT);
  1752. ----
  1753. COMPLETE 0
  1754. simple conn=joe,user=joe
  1755. INSERT INTO t SELECT * FROM t;
  1756. ----
  1757. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1758. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1759. simple conn=child,user=child
  1760. INSERT INTO t SELECT * FROM t;
  1761. ----
  1762. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1763. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1764. simple conn=mz_system,user=mz_system
  1765. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1766. ----
  1767. COMPLETE 0
  1768. simple conn=joe,user=joe
  1769. INSERT INTO t SELECT * FROM t;
  1770. ----
  1771. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1772. DETAIL: The 'joe' role needs INSERT privileges on TABLE "materialize.public.t"
  1773. simple conn=child,user=child
  1774. INSERT INTO t SELECT * FROM t;
  1775. ----
  1776. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1777. DETAIL: The 'child' role needs INSERT privileges on TABLE "materialize.public.t"
  1778. simple conn=mz_system,user=mz_system
  1779. GRANT INSERT ON TABLE t TO joe;
  1780. ----
  1781. COMPLETE 0
  1782. simple conn=joe,user=joe
  1783. INSERT INTO t SELECT * FROM t;
  1784. ----
  1785. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1786. DETAIL: The 'joe' role needs SELECT privileges on TABLE "materialize.public.t"
  1787. simple conn=child,user=child
  1788. INSERT INTO t SELECT * FROM t;
  1789. ----
  1790. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1791. DETAIL: The 'child' role needs SELECT privileges on TABLE "materialize.public.t"
  1792. simple conn=mz_system,user=mz_system
  1793. GRANT SELECT ON TABLE t TO joe;
  1794. ----
  1795. COMPLETE 0
  1796. simple conn=joe,user=joe
  1797. INSERT INTO t SELECT * FROM t;
  1798. ----
  1799. db error: ERROR: permission denied for CLUSTER "quickstart"
  1800. DETAIL: The 'joe' role needs USAGE privileges on CLUSTER "quickstart"
  1801. simple conn=child,user=child
  1802. INSERT INTO t SELECT * FROM t;
  1803. ----
  1804. db error: ERROR: permission denied for CLUSTER "quickstart"
  1805. DETAIL: The 'child' role needs USAGE privileges on CLUSTER "quickstart"
  1806. simple conn=mz_system,user=mz_system
  1807. GRANT USAGE ON CLUSTER quickstart TO joe;
  1808. ----
  1809. COMPLETE 0
  1810. simple conn=joe,user=joe
  1811. INSERT INTO t SELECT * FROM t;
  1812. ----
  1813. COMPLETE 0
  1814. simple conn=child,user=child
  1815. INSERT INTO t SELECT * FROM t;
  1816. ----
  1817. COMPLETE 0
  1818. simple conn=mz_system,user=mz_system
  1819. REVOKE INSERT ON TABLE t FROM joe;
  1820. ----
  1821. COMPLETE 0
  1822. simple conn=joe,user=joe
  1823. INSERT INTO t SELECT * FROM t;
  1824. ----
  1825. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1826. DETAIL: The 'joe' role needs INSERT privileges on TABLE "materialize.public.t"
  1827. simple conn=child,user=child
  1828. INSERT INTO t SELECT * FROM t;
  1829. ----
  1830. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1831. DETAIL: The 'child' role needs INSERT privileges on TABLE "materialize.public.t"
  1832. simple conn=mz_system,user=mz_system
  1833. REVOKE SELECT ON TABLE t FROM joe;
  1834. ----
  1835. COMPLETE 0
  1836. simple conn=mz_system,user=mz_system
  1837. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1838. ----
  1839. COMPLETE 0
  1840. simple conn=mz_system,user=mz_system
  1841. REVOKE USAGE ON CLUSTER quickstart FROM joe;
  1842. ----
  1843. COMPLETE 0
  1844. simple conn=mz_system,user=mz_system
  1845. DROP TABLE t;
  1846. ----
  1847. COMPLETE 0
  1848. # INSERT ... RETURNING
  1849. simple conn=mz_system,user=mz_system
  1850. CREATE TABLE t (a INT);
  1851. ----
  1852. COMPLETE 0
  1853. simple conn=joe,user=joe
  1854. INSERT INTO t VALUES (42) RETURNING a;
  1855. ----
  1856. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1857. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1858. simple conn=child,user=child
  1859. INSERT INTO t VALUES (42) RETURNING a;
  1860. ----
  1861. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1862. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1863. simple conn=mz_system,user=mz_system
  1864. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1865. ----
  1866. COMPLETE 0
  1867. simple conn=joe,user=joe
  1868. INSERT INTO t VALUES (42) RETURNING a;
  1869. ----
  1870. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1871. DETAIL: The 'joe' role needs INSERT privileges on TABLE "materialize.public.t"
  1872. simple conn=child,user=child
  1873. INSERT INTO t VALUES (42) RETURNING a;
  1874. ----
  1875. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1876. DETAIL: The 'child' role needs INSERT privileges on TABLE "materialize.public.t"
  1877. simple conn=mz_system,user=mz_system
  1878. GRANT INSERT ON TABLE t TO joe;
  1879. ----
  1880. COMPLETE 0
  1881. simple conn=joe,user=joe
  1882. INSERT INTO t VALUES (42) RETURNING a;
  1883. ----
  1884. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1885. DETAIL: The 'joe' role needs SELECT privileges on TABLE "materialize.public.t"
  1886. simple conn=child,user=child
  1887. INSERT INTO t VALUES (42) RETURNING a;
  1888. ----
  1889. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1890. DETAIL: The 'child' role needs SELECT privileges on TABLE "materialize.public.t"
  1891. simple conn=mz_system,user=mz_system
  1892. GRANT SELECT ON TABLE t TO joe;
  1893. ----
  1894. COMPLETE 0
  1895. simple conn=joe,user=joe
  1896. INSERT INTO t VALUES (42) RETURNING a;
  1897. ----
  1898. db error: ERROR: permission denied for CLUSTER "quickstart"
  1899. DETAIL: The 'joe' role needs USAGE privileges on CLUSTER "quickstart"
  1900. simple conn=child,user=child
  1901. INSERT INTO t VALUES (42) RETURNING a;
  1902. ----
  1903. db error: ERROR: permission denied for CLUSTER "quickstart"
  1904. DETAIL: The 'child' role needs USAGE privileges on CLUSTER "quickstart"
  1905. simple conn=mz_system,user=mz_system
  1906. GRANT USAGE ON CLUSTER quickstart TO joe;
  1907. ----
  1908. COMPLETE 0
  1909. simple conn=joe,user=joe
  1910. INSERT INTO t VALUES (42) RETURNING a;
  1911. ----
  1912. 42
  1913. COMPLETE 1
  1914. simple conn=child,user=child
  1915. INSERT INTO t VALUES (42) RETURNING a;
  1916. ----
  1917. 42
  1918. COMPLETE 1
  1919. simple conn=mz_system,user=mz_system
  1920. REVOKE INSERT ON TABLE t FROM joe;
  1921. ----
  1922. COMPLETE 0
  1923. simple conn=joe,user=joe
  1924. INSERT INTO t VALUES (42) RETURNING a;
  1925. ----
  1926. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1927. DETAIL: The 'joe' role needs INSERT privileges on TABLE "materialize.public.t"
  1928. simple conn=child,user=child
  1929. INSERT INTO t VALUES (42) RETURNING a;
  1930. ----
  1931. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1932. DETAIL: The 'child' role needs INSERT privileges on TABLE "materialize.public.t"
  1933. simple conn=mz_system,user=mz_system
  1934. REVOKE SELECT ON TABLE t FROM joe;
  1935. ----
  1936. COMPLETE 0
  1937. simple conn=mz_system,user=mz_system
  1938. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  1939. ----
  1940. COMPLETE 0
  1941. simple conn=mz_system,user=mz_system
  1942. REVOKE USAGE ON CLUSTER quickstart FROM joe;
  1943. ----
  1944. COMPLETE 0
  1945. simple conn=mz_system,user=mz_system
  1946. DROP TABLE t;
  1947. ----
  1948. COMPLETE 0
  1949. # UPDATE (no WHERE)
  1950. simple conn=mz_system,user=mz_system
  1951. CREATE TABLE t (a INT);
  1952. ----
  1953. COMPLETE 0
  1954. simple conn=joe,user=joe
  1955. UPDATE t SET a = 42;
  1956. ----
  1957. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1958. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  1959. simple conn=child,user=child
  1960. UPDATE t SET a = 42;
  1961. ----
  1962. db error: ERROR: permission denied for SCHEMA "materialize.public"
  1963. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  1964. simple conn=mz_system,user=mz_system
  1965. GRANT USAGE ON SCHEMA materialize.public TO joe;
  1966. ----
  1967. COMPLETE 0
  1968. simple conn=joe,user=joe
  1969. UPDATE t SET a = 42;
  1970. ----
  1971. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1972. DETAIL: The 'joe' role needs UPDATE privileges on TABLE "materialize.public.t"
  1973. simple conn=child,user=child
  1974. UPDATE t SET a = 42;
  1975. ----
  1976. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1977. DETAIL: The 'child' role needs UPDATE privileges on TABLE "materialize.public.t"
  1978. simple conn=mz_system,user=mz_system
  1979. GRANT UPDATE ON TABLE t TO joe;
  1980. ----
  1981. COMPLETE 0
  1982. simple conn=joe,user=joe
  1983. UPDATE T SET a = 42 WHERE a > 6;
  1984. ----
  1985. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1986. DETAIL: The 'joe' role needs SELECT privileges on TABLE "materialize.public.t"
  1987. simple conn=child,user=child
  1988. UPDATE T SET a = 42 WHERE a > 6;
  1989. ----
  1990. db error: ERROR: permission denied for TABLE "materialize.public.t"
  1991. DETAIL: The 'child' role needs SELECT privileges on TABLE "materialize.public.t"
  1992. simple conn=mz_system,user=mz_system
  1993. GRANT SELECT ON TABLE t TO joe;
  1994. ----
  1995. COMPLETE 0
  1996. simple conn=joe,user=joe
  1997. UPDATE t SET a = 42;
  1998. ----
  1999. db error: ERROR: permission denied for CLUSTER "quickstart"
  2000. DETAIL: The 'joe' role needs USAGE privileges on CLUSTER "quickstart"
  2001. simple conn=child,user=child
  2002. UPDATE t SET a = 42;
  2003. ----
  2004. db error: ERROR: permission denied for CLUSTER "quickstart"
  2005. DETAIL: The 'child' role needs USAGE privileges on CLUSTER "quickstart"
  2006. simple conn=mz_system,user=mz_system
  2007. GRANT USAGE ON CLUSTER quickstart TO joe;
  2008. ----
  2009. COMPLETE 0
  2010. simple conn=joe,user=joe
  2011. UPDATE t SET a = 42;
  2012. ----
  2013. COMPLETE 0
  2014. simple conn=child,user=child
  2015. UPDATE t SET a = 42;
  2016. ----
  2017. COMPLETE 0
  2018. simple conn=mz_system,user=mz_system
  2019. REVOKE UPDATE ON TABLE t FROM joe;
  2020. ----
  2021. COMPLETE 0
  2022. simple conn=joe,user=joe
  2023. UPDATE t SET a = 42;
  2024. ----
  2025. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2026. DETAIL: The 'joe' role needs UPDATE privileges on TABLE "materialize.public.t"
  2027. simple conn=child,user=child
  2028. UPDATE t SET a = 42;
  2029. ----
  2030. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2031. DETAIL: The 'child' role needs UPDATE privileges on TABLE "materialize.public.t"
  2032. simple conn=mz_system,user=mz_system
  2033. REVOKE SELECT ON TABLE t FROM joe;
  2034. ----
  2035. COMPLETE 0
  2036. simple conn=mz_system,user=mz_system
  2037. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  2038. ----
  2039. COMPLETE 0
  2040. simple conn=mz_system,user=mz_system
  2041. REVOKE USAGE ON CLUSTER quickstart FROM joe;
  2042. ----
  2043. COMPLETE 0
  2044. simple conn=mz_system,user=mz_system
  2045. DROP TABLE t;
  2046. ----
  2047. COMPLETE 0
  2048. # UPDATE (with WHERE)
  2049. simple conn=mz_system,user=mz_system
  2050. CREATE TABLE t (a INT);
  2051. ----
  2052. COMPLETE 0
  2053. simple conn=joe,user=joe
  2054. UPDATE T SET a = 42 WHERE a > 6;
  2055. ----
  2056. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2057. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  2058. simple conn=child,user=child
  2059. UPDATE T SET a = 42 WHERE a > 6;
  2060. ----
  2061. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2062. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  2063. simple conn=mz_system,user=mz_system
  2064. GRANT USAGE ON SCHEMA materialize.public TO joe;
  2065. ----
  2066. COMPLETE 0
  2067. simple conn=joe,user=joe
  2068. UPDATE T SET a = 42 WHERE a > 6;
  2069. ----
  2070. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2071. DETAIL: The 'joe' role needs UPDATE privileges on TABLE "materialize.public.t"
  2072. simple conn=child,user=child
  2073. UPDATE T SET a = 42 WHERE a > 6;
  2074. ----
  2075. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2076. DETAIL: The 'child' role needs UPDATE privileges on TABLE "materialize.public.t"
  2077. simple conn=mz_system,user=mz_system
  2078. GRANT UPDATE ON TABLE t TO joe;
  2079. ----
  2080. COMPLETE 0
  2081. simple conn=joe,user=joe
  2082. UPDATE T SET a = 42 WHERE a > 6;
  2083. ----
  2084. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2085. DETAIL: The 'joe' role needs SELECT privileges on TABLE "materialize.public.t"
  2086. simple conn=child,user=child
  2087. UPDATE T SET a = 42 WHERE a > 6;
  2088. ----
  2089. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2090. DETAIL: The 'child' role needs SELECT privileges on TABLE "materialize.public.t"
  2091. simple conn=mz_system,user=mz_system
  2092. GRANT SELECT ON TABLE t TO joe;
  2093. ----
  2094. COMPLETE 0
  2095. simple conn=joe,user=joe
  2096. UPDATE T SET a = 42 WHERE a > 6;
  2097. ----
  2098. db error: ERROR: permission denied for CLUSTER "quickstart"
  2099. DETAIL: The 'joe' role needs USAGE privileges on CLUSTER "quickstart"
  2100. simple conn=child,user=child
  2101. UPDATE T SET a = 42 WHERE a > 6;
  2102. ----
  2103. db error: ERROR: permission denied for CLUSTER "quickstart"
  2104. DETAIL: The 'child' role needs USAGE privileges on CLUSTER "quickstart"
  2105. simple conn=mz_system,user=mz_system
  2106. GRANT USAGE ON CLUSTER quickstart TO joe;
  2107. ----
  2108. COMPLETE 0
  2109. simple conn=joe,user=joe
  2110. UPDATE T SET a = 42 WHERE a > 6;
  2111. ----
  2112. COMPLETE 0
  2113. simple conn=child,user=child
  2114. UPDATE T SET a = 42 WHERE a > 6;
  2115. ----
  2116. COMPLETE 0
  2117. simple conn=mz_system,user=mz_system
  2118. REVOKE UPDATE ON TABLE t FROM joe;
  2119. ----
  2120. COMPLETE 0
  2121. simple conn=joe,user=joe
  2122. UPDATE T SET a = 42 WHERE a > 6;
  2123. ----
  2124. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2125. DETAIL: The 'joe' role needs UPDATE privileges on TABLE "materialize.public.t"
  2126. simple conn=child,user=child
  2127. UPDATE T SET a = 42 WHERE a > 6;
  2128. ----
  2129. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2130. DETAIL: The 'child' role needs UPDATE privileges on TABLE "materialize.public.t"
  2131. simple conn=mz_system,user=mz_system
  2132. REVOKE SELECT ON TABLE t FROM joe;
  2133. ----
  2134. COMPLETE 0
  2135. simple conn=mz_system,user=mz_system
  2136. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  2137. ----
  2138. COMPLETE 0
  2139. simple conn=mz_system,user=mz_system
  2140. REVOKE USAGE ON CLUSTER quickstart FROM joe;
  2141. ----
  2142. COMPLETE 0
  2143. simple conn=mz_system,user=mz_system
  2144. DROP TABLE t;
  2145. ----
  2146. COMPLETE 0
  2147. # UPDATE (non-const assignment)
  2148. simple conn=mz_system,user=mz_system
  2149. CREATE TABLE t (a INT);
  2150. ----
  2151. COMPLETE 0
  2152. simple conn=joe,user=joe
  2153. UPDATE T SET a = a + 10;
  2154. ----
  2155. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2156. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  2157. simple conn=child,user=child
  2158. UPDATE T SET a = a + 10;
  2159. ----
  2160. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2161. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  2162. simple conn=mz_system,user=mz_system
  2163. GRANT USAGE ON SCHEMA materialize.public TO joe;
  2164. ----
  2165. COMPLETE 0
  2166. simple conn=joe,user=joe
  2167. UPDATE T SET a = a + 10;
  2168. ----
  2169. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2170. DETAIL: The 'joe' role needs UPDATE privileges on TABLE "materialize.public.t"
  2171. simple conn=child,user=child
  2172. UPDATE T SET a = a + 10;
  2173. ----
  2174. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2175. DETAIL: The 'child' role needs UPDATE privileges on TABLE "materialize.public.t"
  2176. simple conn=mz_system,user=mz_system
  2177. GRANT UPDATE ON TABLE t TO joe;
  2178. ----
  2179. COMPLETE 0
  2180. simple conn=joe,user=joe
  2181. UPDATE T SET a = a + 10;
  2182. ----
  2183. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2184. DETAIL: The 'joe' role needs SELECT privileges on TABLE "materialize.public.t"
  2185. simple conn=child,user=child
  2186. UPDATE T SET a = a + 10;
  2187. ----
  2188. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2189. DETAIL: The 'child' role needs SELECT privileges on TABLE "materialize.public.t"
  2190. simple conn=mz_system,user=mz_system
  2191. GRANT SELECT ON TABLE t TO joe;
  2192. ----
  2193. COMPLETE 0
  2194. simple conn=joe,user=joe
  2195. UPDATE T SET a = a + 10;
  2196. ----
  2197. db error: ERROR: permission denied for CLUSTER "quickstart"
  2198. DETAIL: The 'joe' role needs USAGE privileges on CLUSTER "quickstart"
  2199. simple conn=child,user=child
  2200. UPDATE T SET a = a + 10;
  2201. ----
  2202. db error: ERROR: permission denied for CLUSTER "quickstart"
  2203. DETAIL: The 'child' role needs USAGE privileges on CLUSTER "quickstart"
  2204. simple conn=mz_system,user=mz_system
  2205. GRANT USAGE ON CLUSTER quickstart TO joe;
  2206. ----
  2207. COMPLETE 0
  2208. simple conn=joe,user=joe
  2209. UPDATE T SET a = a + 10;
  2210. ----
  2211. COMPLETE 0
  2212. simple conn=child,user=child
  2213. UPDATE T SET a = a + 10;
  2214. ----
  2215. COMPLETE 0
  2216. simple conn=mz_system,user=mz_system
  2217. REVOKE UPDATE ON TABLE t FROM joe;
  2218. ----
  2219. COMPLETE 0
  2220. simple conn=joe,user=joe
  2221. UPDATE T SET a = a + 10;
  2222. ----
  2223. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2224. DETAIL: The 'joe' role needs UPDATE privileges on TABLE "materialize.public.t"
  2225. simple conn=child,user=child
  2226. UPDATE T SET a = a + 10;
  2227. ----
  2228. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2229. DETAIL: The 'child' role needs UPDATE privileges on TABLE "materialize.public.t"
  2230. simple conn=mz_system,user=mz_system
  2231. REVOKE SELECT ON TABLE t FROM joe;
  2232. ----
  2233. COMPLETE 0
  2234. simple conn=mz_system,user=mz_system
  2235. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  2236. ----
  2237. COMPLETE 0
  2238. simple conn=mz_system,user=mz_system
  2239. REVOKE USAGE ON CLUSTER quickstart FROM joe;
  2240. ----
  2241. COMPLETE 0
  2242. simple conn=mz_system,user=mz_system
  2243. DROP TABLE t;
  2244. ----
  2245. COMPLETE 0
  2246. # DELETE (no WHERE)
  2247. simple conn=mz_system,user=mz_system
  2248. CREATE TABLE t (a INT);
  2249. ----
  2250. COMPLETE 0
  2251. simple conn=joe,user=joe
  2252. DELETE FROM t;
  2253. ----
  2254. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2255. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  2256. simple conn=child,user=child
  2257. DELETE FROM t;
  2258. ----
  2259. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2260. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  2261. simple conn=mz_system,user=mz_system
  2262. GRANT USAGE ON SCHEMA materialize.public TO joe;
  2263. ----
  2264. COMPLETE 0
  2265. simple conn=joe,user=joe
  2266. DELETE FROM t;
  2267. ----
  2268. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2269. DETAIL: The 'joe' role needs DELETE privileges on TABLE "materialize.public.t"
  2270. simple conn=child,user=child
  2271. DELETE FROM t;
  2272. ----
  2273. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2274. DETAIL: The 'child' role needs DELETE privileges on TABLE "materialize.public.t"
  2275. simple conn=mz_system,user=mz_system
  2276. GRANT DELETE ON TABLE t TO joe;
  2277. ----
  2278. COMPLETE 0
  2279. simple conn=joe,user=joe
  2280. DELETE FROM t WHERE a > 5;
  2281. ----
  2282. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2283. DETAIL: The 'joe' role needs SELECT privileges on TABLE "materialize.public.t"
  2284. simple conn=child,user=child
  2285. DELETE FROM t WHERE a > 5;
  2286. ----
  2287. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2288. DETAIL: The 'child' role needs SELECT privileges on TABLE "materialize.public.t"
  2289. simple conn=mz_system,user=mz_system
  2290. GRANT SELECT ON TABLE t TO joe;
  2291. ----
  2292. COMPLETE 0
  2293. simple conn=joe,user=joe
  2294. DELETE FROM t;
  2295. ----
  2296. db error: ERROR: permission denied for CLUSTER "quickstart"
  2297. DETAIL: The 'joe' role needs USAGE privileges on CLUSTER "quickstart"
  2298. simple conn=child,user=child
  2299. DELETE FROM t;
  2300. ----
  2301. db error: ERROR: permission denied for CLUSTER "quickstart"
  2302. DETAIL: The 'child' role needs USAGE privileges on CLUSTER "quickstart"
  2303. simple conn=mz_system,user=mz_system
  2304. GRANT USAGE ON CLUSTER quickstart TO joe;
  2305. ----
  2306. COMPLETE 0
  2307. simple conn=joe,user=joe
  2308. DELETE FROM t;
  2309. ----
  2310. COMPLETE 0
  2311. simple conn=child,user=child
  2312. DELETE FROM t;
  2313. ----
  2314. COMPLETE 0
  2315. simple conn=mz_system,user=mz_system
  2316. REVOKE DELETE ON TABLE t FROM joe;
  2317. ----
  2318. COMPLETE 0
  2319. simple conn=joe,user=joe
  2320. DELETE FROM t;
  2321. ----
  2322. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2323. DETAIL: The 'joe' role needs DELETE privileges on TABLE "materialize.public.t"
  2324. simple conn=child,user=child
  2325. DELETE FROM t;
  2326. ----
  2327. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2328. DETAIL: The 'child' role needs DELETE privileges on TABLE "materialize.public.t"
  2329. simple conn=mz_system,user=mz_system
  2330. REVOKE SELECT ON TABLE t FROM joe;
  2331. ----
  2332. COMPLETE 0
  2333. simple conn=mz_system,user=mz_system
  2334. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  2335. ----
  2336. COMPLETE 0
  2337. simple conn=mz_system,user=mz_system
  2338. REVOKE USAGE ON CLUSTER quickstart FROM joe;
  2339. ----
  2340. COMPLETE 0
  2341. simple conn=mz_system,user=mz_system
  2342. DROP TABLE t;
  2343. ----
  2344. COMPLETE 0
  2345. # DELETE (with WHERE)
  2346. simple conn=mz_system,user=mz_system
  2347. CREATE TABLE t (a INT);
  2348. ----
  2349. COMPLETE 0
  2350. simple conn=joe,user=joe
  2351. DELETE FROM t WHERE a > 5;
  2352. ----
  2353. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2354. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  2355. simple conn=child,user=child
  2356. DELETE FROM t WHERE a > 5;
  2357. ----
  2358. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2359. DETAIL: The 'child' role needs USAGE privileges on SCHEMA "materialize.public"
  2360. simple conn=mz_system,user=mz_system
  2361. GRANT USAGE ON SCHEMA materialize.public TO joe;
  2362. ----
  2363. COMPLETE 0
  2364. simple conn=joe,user=joe
  2365. DELETE FROM t WHERE a > 5;
  2366. ----
  2367. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2368. DETAIL: The 'joe' role needs DELETE privileges on TABLE "materialize.public.t"
  2369. simple conn=child,user=child
  2370. DELETE FROM t WHERE a > 5;
  2371. ----
  2372. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2373. DETAIL: The 'child' role needs DELETE privileges on TABLE "materialize.public.t"
  2374. simple conn=mz_system,user=mz_system
  2375. GRANT DELETE ON TABLE t TO joe;
  2376. ----
  2377. COMPLETE 0
  2378. simple conn=joe,user=joe
  2379. DELETE FROM t WHERE a > 5;
  2380. ----
  2381. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2382. DETAIL: The 'joe' role needs SELECT privileges on TABLE "materialize.public.t"
  2383. simple conn=child,user=child
  2384. DELETE FROM t WHERE a > 5;
  2385. ----
  2386. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2387. DETAIL: The 'child' role needs SELECT privileges on TABLE "materialize.public.t"
  2388. simple conn=mz_system,user=mz_system
  2389. GRANT SELECT ON TABLE t TO joe;
  2390. ----
  2391. COMPLETE 0
  2392. simple conn=joe,user=joe
  2393. DELETE FROM t WHERE a > 5;
  2394. ----
  2395. db error: ERROR: permission denied for CLUSTER "quickstart"
  2396. DETAIL: The 'joe' role needs USAGE privileges on CLUSTER "quickstart"
  2397. simple conn=child,user=child
  2398. DELETE FROM t WHERE a > 5;
  2399. ----
  2400. db error: ERROR: permission denied for CLUSTER "quickstart"
  2401. DETAIL: The 'child' role needs USAGE privileges on CLUSTER "quickstart"
  2402. simple conn=mz_system,user=mz_system
  2403. GRANT USAGE ON CLUSTER quickstart TO joe;
  2404. ----
  2405. COMPLETE 0
  2406. simple conn=joe,user=joe
  2407. DELETE FROM t WHERE a > 5;
  2408. ----
  2409. COMPLETE 0
  2410. simple conn=child,user=child
  2411. DELETE FROM t WHERE a > 5;
  2412. ----
  2413. COMPLETE 0
  2414. simple conn=mz_system,user=mz_system
  2415. REVOKE DELETE ON TABLE t FROM joe;
  2416. ----
  2417. COMPLETE 0
  2418. simple conn=joe,user=joe
  2419. DELETE FROM t WHERE a > 5;
  2420. ----
  2421. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2422. DETAIL: The 'joe' role needs DELETE privileges on TABLE "materialize.public.t"
  2423. simple conn=child,user=child
  2424. DELETE FROM t WHERE a > 5;
  2425. ----
  2426. db error: ERROR: permission denied for TABLE "materialize.public.t"
  2427. DETAIL: The 'child' role needs DELETE privileges on TABLE "materialize.public.t"
  2428. simple conn=mz_system,user=mz_system
  2429. REVOKE SELECT ON TABLE t FROM joe;
  2430. ----
  2431. COMPLETE 0
  2432. simple conn=mz_system,user=mz_system
  2433. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  2434. ----
  2435. COMPLETE 0
  2436. simple conn=mz_system,user=mz_system
  2437. REVOKE USAGE ON CLUSTER quickstart FROM joe;
  2438. ----
  2439. COMPLETE 0
  2440. simple conn=mz_system,user=mz_system
  2441. DROP TABLE t;
  2442. ----
  2443. COMPLETE 0
  2444. # ALTER OWNER
  2445. ## Cluster
  2446. simple conn=mz_system,user=mz_system
  2447. GRANT CREATECLUSTER ON SYSTEM TO joe;
  2448. ----
  2449. COMPLETE 0
  2450. simple conn=joe,user=joe
  2451. CREATE CLUSTER clus REPLICAS (r1 (SIZE '1'));
  2452. ----
  2453. COMPLETE 0
  2454. simple conn=mz_system,user=mz_system
  2455. REVOKE CREATE ON SCHEMA materialize.public FROM joe;
  2456. ----
  2457. COMPLETE 0
  2458. simple conn=joe,user=joe
  2459. ALTER CLUSTER clus OWNER TO other
  2460. ----
  2461. COMPLETE 0
  2462. simple conn=mz_system,user=mz_system
  2463. DROP CLUSTER clus;
  2464. ----
  2465. COMPLETE 0
  2466. ## Cluster Replica
  2467. simple conn=mz_system,user=mz_system
  2468. GRANT CREATECLUSTER ON SYSTEM TO joe;
  2469. ----
  2470. COMPLETE 0
  2471. simple conn=joe,user=joe
  2472. CREATE CLUSTER clus REPLICAS (r1 (SIZE '1'));
  2473. ----
  2474. COMPLETE 0
  2475. simple conn=joe,user=joe
  2476. CREATE CLUSTER REPLICA clus.r2 SIZE '1';
  2477. ----
  2478. COMPLETE 0
  2479. simple conn=mz_system,user=mz_system
  2480. REVOKE CREATECLUSTER ON SYSTEM FROM joe;
  2481. ----
  2482. COMPLETE 0
  2483. simple conn=joe,user=joe
  2484. ALTER CLUSTER REPLICA clus.r2 OWNER TO other;
  2485. ----
  2486. db error: ERROR: altering the owner of a cluster replica is not supported
  2487. simple conn=mz_system,user=mz_system
  2488. DROP CLUSTER clus;
  2489. ----
  2490. COMPLETE 0
  2491. ## Database
  2492. simple conn=mz_system,user=mz_system
  2493. GRANT CREATEDB ON SYSTEM TO joe;
  2494. ----
  2495. COMPLETE 0
  2496. simple conn=joe,user=joe
  2497. CREATE DATABASE db;
  2498. ----
  2499. COMPLETE 0
  2500. simple conn=mz_system,user=mz_system
  2501. REVOKE CREATEDB ON SYSTEM FROM joe;
  2502. ----
  2503. COMPLETE 0
  2504. simple conn=joe,user=joe
  2505. ALTER DATABASE db OWNER TO other;
  2506. ----
  2507. COMPLETE 0
  2508. simple conn=mz_system,user=mz_system
  2509. DROP DATABASE db;
  2510. ----
  2511. COMPLETE 0
  2512. ## Schema
  2513. simple conn=mz_system,user=mz_system
  2514. GRANT CREATE ON DATABASE materialize TO joe;
  2515. ----
  2516. COMPLETE 0
  2517. simple conn=joe,user=joe
  2518. CREATE SCHEMA materialize.sch;
  2519. ----
  2520. COMPLETE 0
  2521. simple conn=mz_system,user=mz_system
  2522. REVOKE CREATE ON DATABASE materialize FROM joe;
  2523. ----
  2524. COMPLETE 0
  2525. simple conn=joe,user=joe
  2526. ALTER SCHEMA materialize.sch OWNER TO other;
  2527. ----
  2528. db error: ERROR: permission denied for DATABASE "materialize"
  2529. DETAIL: The 'joe' role needs CREATE privileges on DATABASE "materialize"
  2530. simple conn=mz_system,user=mz_system
  2531. GRANT CREATE ON DATABASE materialize TO joe;
  2532. ----
  2533. COMPLETE 0
  2534. simple conn=joe,user=joe
  2535. ALTER SCHEMA materialize.sch OWNER TO other;
  2536. ----
  2537. COMPLETE 0
  2538. simple conn=mz_system,user=mz_system
  2539. DROP SCHEMA materialize.sch;
  2540. ----
  2541. COMPLETE 0
  2542. simple conn=mz_system,user=mz_system
  2543. REVOKE CREATE, USAGE ON DATABASE materialize FROM joe;
  2544. ----
  2545. COMPLETE 0
  2546. ## Item
  2547. simple conn=mz_system,user=mz_system
  2548. GRANT CREATE ON SCHEMA materialize.public TO joe;
  2549. ----
  2550. COMPLETE 0
  2551. simple conn=joe,user=joe
  2552. CREATE TABLE t ();
  2553. ----
  2554. COMPLETE 0
  2555. simple conn=mz_system,user=mz_system
  2556. REVOKE CREATE ON SCHEMA materialize.public FROM joe;
  2557. ----
  2558. COMPLETE 0
  2559. simple conn=joe,user=joe
  2560. ALTER TABLE t OWNER TO other;
  2561. ----
  2562. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2563. DETAIL: The 'joe' role needs CREATE privileges on SCHEMA "materialize.public"
  2564. simple conn=mz_system,user=mz_system
  2565. GRANT CREATE ON SCHEMA materialize.public TO joe;
  2566. ----
  2567. COMPLETE 0
  2568. simple conn=joe,user=joe
  2569. ALTER TABLE t OWNER TO other;
  2570. ----
  2571. COMPLETE 0
  2572. simple conn=mz_system,user=mz_system
  2573. DROP TABLE t;
  2574. ----
  2575. COMPLETE 0
  2576. simple conn=mz_system,user=mz_system
  2577. REVOKE CREATE, USAGE ON SCHEMA materialize.public FROM joe;
  2578. ----
  2579. COMPLETE 0
  2580. # GRANT/REVOKE privilege
  2581. ## Cluster
  2582. simple conn=mz_system,user=mz_system
  2583. GRANT CREATECLUSTER ON SYSTEM TO joe;
  2584. ----
  2585. COMPLETE 0
  2586. simple conn=joe,user=joe
  2587. CREATE CLUSTER clus REPLICAS (r1 (SIZE '1'));
  2588. ----
  2589. COMPLETE 0
  2590. simple conn=mz_system,user=mz_system
  2591. REVOKE CREATECLUSTER ON SYSTEM FROM joe;
  2592. ----
  2593. COMPLETE 0
  2594. simple conn=joe,user=joe
  2595. GRANT USAGE, CREATE ON CLUSTER clus TO other
  2596. ----
  2597. COMPLETE 0
  2598. simple conn=joe,user=joe
  2599. REVOKE USAGE, CREATE ON CLUSTER clus FROM other
  2600. ----
  2601. COMPLETE 0
  2602. simple conn=joe,user=joe
  2603. DROP CLUSTER clus;
  2604. ----
  2605. COMPLETE 0
  2606. ## Database
  2607. simple conn=mz_system,user=mz_system
  2608. GRANT CREATEDB ON SYSTEM TO joe;
  2609. ----
  2610. COMPLETE 0
  2611. simple conn=joe,user=joe
  2612. CREATE DATABASE db;
  2613. ----
  2614. COMPLETE 0
  2615. simple conn=mz_system,user=mz_system
  2616. REVOKE CREATEDB ON SYSTEM FROM joe;
  2617. ----
  2618. COMPLETE 0
  2619. simple conn=joe,user=joe
  2620. GRANT CREATE, USAGE ON DATABASE db TO other
  2621. ----
  2622. COMPLETE 0
  2623. simple conn=joe,user=joe
  2624. REVOKE CREATE, USAGE ON DATABASE db FROM other
  2625. ----
  2626. COMPLETE 0
  2627. simple conn=joe,user=joe
  2628. DROP DATABASE db;
  2629. ----
  2630. COMPLETE 0
  2631. ## Schema
  2632. simple conn=mz_system,user=mz_system
  2633. GRANT CREATE ON DATABASE materialize TO joe;
  2634. ----
  2635. COMPLETE 0
  2636. simple conn=joe,user=joe
  2637. CREATE SCHEMA materialize.sch;
  2638. ----
  2639. COMPLETE 0
  2640. simple conn=joe,user=joe
  2641. GRANT CREATE, USAGE ON SCHEMA materialize.sch TO other;
  2642. ----
  2643. db error: ERROR: permission denied for DATABASE "materialize"
  2644. DETAIL: The 'joe' role needs USAGE privileges on DATABASE "materialize"
  2645. simple conn=mz_system,user=mz_system
  2646. GRANT USAGE ON DATABASE materialize TO joe;
  2647. ----
  2648. COMPLETE 0
  2649. simple conn=joe,user=joe
  2650. GRANT CREATE, USAGE ON SCHEMA materialize.sch TO other;
  2651. ----
  2652. COMPLETE 0
  2653. simple conn=mz_system,user=mz_system
  2654. REVOKE USAGE ON DATABASE materialize FROM joe;
  2655. ----
  2656. COMPLETE 0
  2657. simple conn=joe,user=joe
  2658. REVOKE CREATE, USAGE ON SCHEMA materialize.sch FROM other;
  2659. ----
  2660. db error: ERROR: permission denied for DATABASE "materialize"
  2661. DETAIL: The 'joe' role needs USAGE privileges on DATABASE "materialize"
  2662. simple conn=mz_system,user=mz_system
  2663. GRANT USAGE ON DATABASE materialize TO joe;
  2664. ----
  2665. COMPLETE 0
  2666. simple conn=joe,user=joe
  2667. REVOKE CREATE, USAGE ON SCHEMA materialize.sch FROM other;
  2668. ----
  2669. COMPLETE 0
  2670. simple conn=joe,user=joe
  2671. DROP SCHEMA materialize.sch;
  2672. ----
  2673. COMPLETE 0
  2674. simple conn=mz_system,user=mz_system
  2675. REVOKE CREATE, USAGE ON DATABASE materialize FROM joe;
  2676. ----
  2677. COMPLETE 0
  2678. ## Item
  2679. simple conn=mz_system,user=mz_system
  2680. GRANT CREATE ON SCHEMA materialize.public TO joe;
  2681. ----
  2682. COMPLETE 0
  2683. simple conn=joe,user=joe
  2684. CREATE TABLE t ();
  2685. ----
  2686. COMPLETE 0
  2687. simple conn=joe,user=joe
  2688. GRANT INSERT, SELECT ON TABLE t TO other;
  2689. ----
  2690. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2691. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  2692. simple conn=mz_system,user=mz_system
  2693. GRANT USAGE ON SCHEMA materialize.public TO joe;
  2694. ----
  2695. COMPLETE 0
  2696. simple conn=joe,user=joe
  2697. GRANT INSERT, SELECT ON TABLE t TO other;
  2698. ----
  2699. COMPLETE 0
  2700. simple conn=mz_system,user=mz_system
  2701. REVOKE USAGE ON SCHEMA materialize.public FROM joe;
  2702. ----
  2703. COMPLETE 0
  2704. simple conn=joe,user=joe
  2705. REVOKE INSERT, SELECT ON TABLE t FROM other;
  2706. ----
  2707. db error: ERROR: permission denied for SCHEMA "materialize.public"
  2708. DETAIL: The 'joe' role needs USAGE privileges on SCHEMA "materialize.public"
  2709. simple conn=mz_system,user=mz_system
  2710. GRANT USAGE ON SCHEMA materialize.public TO joe;
  2711. ----
  2712. COMPLETE 0
  2713. simple conn=joe,user=joe
  2714. REVOKE INSERT, SELECT ON TABLE t FROM other;
  2715. ----
  2716. COMPLETE 0
  2717. simple conn=joe,user=joe
  2718. DROP TABLE t;
  2719. ----
  2720. COMPLETE 0
  2721. simple conn=mz_system,user=mz_system
  2722. REVOKE CREATE, USAGE ON SCHEMA materialize.public FROM joe;
  2723. ----
  2724. COMPLETE 0
  2725. ## System
  2726. statement error You must be a superuser to GRANT/REVOKE SYSTEM PRIVILEGES
  2727. GRANT CREATEDB ON SYSTEM TO joe
  2728. simple conn=mz_system,user=mz_system
  2729. GRANT CREATEDB ON SYSTEM TO joe;
  2730. ----
  2731. COMPLETE 0
  2732. statement error You must be a superuser to GRANT/REVOKE SYSTEM PRIVILEGES
  2733. REVOKE CREATEDB ON SYSTEM FROM joe
  2734. simple conn=mz_system,user=mz_system
  2735. REVOKE CREATEDB ON SYSTEM FROM joe
  2736. ----
  2737. COMPLETE 0
  2738. # GRANT/REVOKE role
  2739. simple conn=mz_system,user=mz_system
  2740. REVOKE ALL PRIVILEGES ON SYSTEM FROM joe;
  2741. ----
  2742. COMPLETE 0
  2743. simple conn=mz_system,user=mz_system
  2744. CREATE ROLE r1
  2745. ----
  2746. COMPLETE 0
  2747. simple conn=mz_system,user=mz_system
  2748. CREATE ROLE r2
  2749. ----
  2750. COMPLETE 0
  2751. simple conn=mz_system,user=mz_system
  2752. CREATE ROLE r3
  2753. ----
  2754. COMPLETE 0
  2755. simple conn=mz_system,user=mz_system
  2756. GRANT r1, r2 TO joe
  2757. ----
  2758. COMPLETE 0
  2759. simple conn=joe,user=joe
  2760. GRANT r2 TO r1;
  2761. ----
  2762. db error: ERROR: permission denied for SYSTEM
  2763. DETAIL: The 'joe' role needs CREATEROLE privileges on SYSTEM
  2764. simple conn=child,user=child
  2765. GRANT r2 TO r1;
  2766. ----
  2767. db error: ERROR: permission denied for SYSTEM
  2768. DETAIL: The 'child' role needs CREATEROLE privileges on SYSTEM
  2769. simple conn=mz_system,user=mz_system
  2770. GRANT CREATEROLE ON SYSTEM TO joe;
  2771. ----
  2772. COMPLETE 0
  2773. simple conn=joe,user=joe
  2774. GRANT r2 TO r1;
  2775. ----
  2776. COMPLETE 0
  2777. simple conn=child,user=child
  2778. GRANT r3 TO r1;
  2779. ----
  2780. COMPLETE 0
  2781. simple conn=mz_system,user=mz_system
  2782. REVOKE CREATEROLE ON SYSTEM FROM joe;
  2783. ----
  2784. COMPLETE 0
  2785. simple conn=joe,user=joe
  2786. REVOKE r2 FROM r1;
  2787. ----
  2788. db error: ERROR: permission denied for SYSTEM
  2789. DETAIL: The 'joe' role needs CREATEROLE privileges on SYSTEM
  2790. simple conn=child,user=child
  2791. REVOKE r3 FROM r1;
  2792. ----
  2793. db error: ERROR: permission denied for SYSTEM
  2794. DETAIL: The 'child' role needs CREATEROLE privileges on SYSTEM
  2795. simple conn=mz_system,user=mz_system
  2796. GRANT CREATEROLE ON SYSTEM TO joe;
  2797. ----
  2798. COMPLETE 0
  2799. simple conn=joe,user=joe
  2800. REVOKE r2 FROM r1;
  2801. ----
  2802. COMPLETE 0
  2803. simple conn=child,user=child
  2804. REVOKE r3 FROM r1;
  2805. ----
  2806. COMPLETE 0
  2807. simple conn=mz_system,user=mz_system
  2808. REVOKE CREATEROLE ON SYSTEM FROM joe;
  2809. ----
  2810. COMPLETE 0
  2811. simple conn=mz_system,user=mz_system
  2812. DROP ROLE r1, r2, r3;
  2813. ----
  2814. COMPLETE 0
  2815. # Disable rbac checks.
  2816. simple conn=mz_system,user=mz_system
  2817. ALTER SYSTEM SET enable_rbac_checks TO false;
  2818. ----
  2819. COMPLETE 0