notice.pt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. # Test various NOTICE expectations.
  2. send
  3. Query {"query": "DROP TABLE IF EXISTS t CASCADE"}
  4. Query {"query": "DROP ROLE IF EXISTS joe"}
  5. ----
  6. until ignore=NoticeResponse
  7. ReadyForQuery
  8. ReadyForQuery
  9. ----
  10. CommandComplete {"tag":"DROP TABLE"}
  11. ReadyForQuery {"status":"I"}
  12. CommandComplete {"tag":"DROP ROLE"}
  13. ReadyForQuery {"status":"I"}
  14. send
  15. Query {"query": "create table t(a int, b int)"}
  16. Query {"query": "create index t_idx_a on t(a)"}
  17. Query {"query": "create materialized view mv1 as select * from t where b=7"}
  18. Query {"query": "create view v1 as select * from t union select * from t"}
  19. Query {"query": "create index v1_idx_a on v1(a)"}
  20. Query {"query": "drop index v1_idx_a"}
  21. Query {"query": "drop index t_idx_a"}
  22. Query {"query": "drop materialized view mv1"}
  23. Query {"query": "create index v1_idx_a on v1(a)"}
  24. Query {"query": "create materialized view mv2 as select * from t where a=5"}
  25. Query {"query": "drop index v1_idx_a"}
  26. Query {"query": "drop materialized view mv2"}
  27. Query {"query": "create index t_idx_a on t(a)"}
  28. Query {"query": "create materialized view mv2 as select * from t where a=5"}
  29. Query {"query": "drop index t_idx_a"}
  30. Query {"query": "create index t_idx_a on t(a)"}
  31. Query {"query": "create index v1_idx_a on v1(a)"}
  32. Query {"query": "drop index t_idx_a"}
  33. Query {"query": "drop index v1_idx_a"}
  34. ----
  35. # Ignore the notice messages because they change sometimes based on when things are internally dropped.
  36. until err_field_typs=SC
  37. ReadyForQuery
  38. ReadyForQuery
  39. ReadyForQuery
  40. ReadyForQuery
  41. ReadyForQuery
  42. ReadyForQuery
  43. ReadyForQuery
  44. ReadyForQuery
  45. ReadyForQuery
  46. ReadyForQuery
  47. ReadyForQuery
  48. ReadyForQuery
  49. ReadyForQuery
  50. ReadyForQuery
  51. ReadyForQuery
  52. ReadyForQuery
  53. ReadyForQuery
  54. ReadyForQuery
  55. ReadyForQuery
  56. ----
  57. CommandComplete {"tag":"CREATE TABLE"}
  58. ReadyForQuery {"status":"I"}
  59. CommandComplete {"tag":"CREATE INDEX"}
  60. ReadyForQuery {"status":"I"}
  61. CommandComplete {"tag":"CREATE MATERIALIZED VIEW"}
  62. ReadyForQuery {"status":"I"}
  63. CommandComplete {"tag":"CREATE VIEW"}
  64. ReadyForQuery {"status":"I"}
  65. CommandComplete {"tag":"CREATE INDEX"}
  66. ReadyForQuery {"status":"I"}
  67. CommandComplete {"tag":"DROP INDEX"}
  68. ReadyForQuery {"status":"I"}
  69. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"00000"}]}
  70. CommandComplete {"tag":"DROP INDEX"}
  71. ReadyForQuery {"status":"I"}
  72. CommandComplete {"tag":"DROP MATERIALIZED VIEW"}
  73. ReadyForQuery {"status":"I"}
  74. CommandComplete {"tag":"CREATE INDEX"}
  75. ReadyForQuery {"status":"I"}
  76. CommandComplete {"tag":"CREATE MATERIALIZED VIEW"}
  77. ReadyForQuery {"status":"I"}
  78. CommandComplete {"tag":"DROP INDEX"}
  79. ReadyForQuery {"status":"I"}
  80. CommandComplete {"tag":"DROP MATERIALIZED VIEW"}
  81. ReadyForQuery {"status":"I"}
  82. CommandComplete {"tag":"CREATE INDEX"}
  83. ReadyForQuery {"status":"I"}
  84. CommandComplete {"tag":"CREATE MATERIALIZED VIEW"}
  85. ReadyForQuery {"status":"I"}
  86. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"00000"}]}
  87. CommandComplete {"tag":"DROP INDEX"}
  88. ReadyForQuery {"status":"I"}
  89. CommandComplete {"tag":"CREATE INDEX"}
  90. ReadyForQuery {"status":"I"}
  91. CommandComplete {"tag":"CREATE INDEX"}
  92. ReadyForQuery {"status":"I"}
  93. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"00000"}]}
  94. CommandComplete {"tag":"DROP INDEX"}
  95. ReadyForQuery {"status":"I"}
  96. CommandComplete {"tag":"DROP INDEX"}
  97. ReadyForQuery {"status":"I"}
  98. # Test setting session variables to nonexistant values
  99. # Scenarios tested: nonexistant values, exstant values, capitalized variables
  100. # double quotes, single quotes, default values
  101. send
  102. Query {"query": "set database = nonexistant"}
  103. Query {"query": "show database"}
  104. Query {"query": "set database = materialize"}
  105. Query {"query": "show database"}
  106. Query {"query": "set DATABASE = NONexistant2"}
  107. Query {"query": "set database = \"nonexistant3\""}
  108. Query {"query": "set database = \"materialize\""}
  109. Query {"query": "show database"}
  110. Query {"query": "set database = 'materialize'"}
  111. Query {"query": "show database"}
  112. Query {"query": "set database = default"}
  113. Query {"query": "show database"}
  114. Query {"query": "set schema = nonexistant"}
  115. Query {"query": "show schema"}
  116. Query {"query": "set schema = public"}
  117. Query {"query": "show schema"}
  118. Query {"query": "set SCHEMA = NONexistant2"}
  119. Query {"query": "set schema = \"nonexistant3\""}
  120. Query {"query": "set schema = \"public\""}
  121. Query {"query": "show schema"}
  122. Query {"query": "set schema = 'public'"}
  123. Query {"query": "show schema"}
  124. Query {"query": "set schema = default"}
  125. Query {"query": "show schema"}
  126. Query {"query": "set cluster = nonexistant"}
  127. Query {"query": "show cluster"}
  128. Query {"query": "set CLUSTER = NONexistant2"}
  129. Query {"query": "show cluster"}
  130. Query {"query": "set cluster = \"quickstart\""}
  131. Query {"query": "show cluster"}
  132. ----
  133. until
  134. ReadyForQuery
  135. ReadyForQuery
  136. ReadyForQuery
  137. ReadyForQuery
  138. ReadyForQuery
  139. ReadyForQuery
  140. ReadyForQuery
  141. ReadyForQuery
  142. ReadyForQuery
  143. ReadyForQuery
  144. ReadyForQuery
  145. ReadyForQuery
  146. ReadyForQuery
  147. ReadyForQuery
  148. ReadyForQuery
  149. ReadyForQuery
  150. ReadyForQuery
  151. ReadyForQuery
  152. ReadyForQuery
  153. ReadyForQuery
  154. ReadyForQuery
  155. ReadyForQuery
  156. ReadyForQuery
  157. ReadyForQuery
  158. ReadyForQuery
  159. ReadyForQuery
  160. ReadyForQuery
  161. ReadyForQuery
  162. ReadyForQuery
  163. ReadyForQuery
  164. ----
  165. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ006"},{"typ":"M","value":"database \"nonexistant\" does not exist"}]}
  166. CommandComplete {"tag":"SET"}
  167. ReadyForQuery {"status":"I"}
  168. RowDescription {"fields":[{"name":"database"}]}
  169. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ006"},{"typ":"M","value":"database \"nonexistant\" does not exist"}]}
  170. DataRow {"fields":["nonexistant"]}
  171. CommandComplete {"tag":"SELECT 1"}
  172. ReadyForQuery {"status":"I"}
  173. CommandComplete {"tag":"SET"}
  174. ReadyForQuery {"status":"I"}
  175. RowDescription {"fields":[{"name":"database"}]}
  176. DataRow {"fields":["materialize"]}
  177. CommandComplete {"tag":"SELECT 1"}
  178. ReadyForQuery {"status":"I"}
  179. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ006"},{"typ":"M","value":"database \"nonexistant2\" does not exist"}]}
  180. CommandComplete {"tag":"SET"}
  181. ReadyForQuery {"status":"I"}
  182. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ006"},{"typ":"M","value":"database \"nonexistant3\" does not exist"}]}
  183. CommandComplete {"tag":"SET"}
  184. ReadyForQuery {"status":"I"}
  185. CommandComplete {"tag":"SET"}
  186. ReadyForQuery {"status":"I"}
  187. RowDescription {"fields":[{"name":"database"}]}
  188. DataRow {"fields":["materialize"]}
  189. CommandComplete {"tag":"SELECT 1"}
  190. ReadyForQuery {"status":"I"}
  191. CommandComplete {"tag":"SET"}
  192. ReadyForQuery {"status":"I"}
  193. RowDescription {"fields":[{"name":"database"}]}
  194. DataRow {"fields":["materialize"]}
  195. CommandComplete {"tag":"SELECT 1"}
  196. ReadyForQuery {"status":"I"}
  197. CommandComplete {"tag":"SET"}
  198. ReadyForQuery {"status":"I"}
  199. RowDescription {"fields":[{"name":"database"}]}
  200. DataRow {"fields":["materialize"]}
  201. CommandComplete {"tag":"SELECT 1"}
  202. ReadyForQuery {"status":"I"}
  203. CommandComplete {"tag":"SET"}
  204. ReadyForQuery {"status":"I"}
  205. RowDescription {"fields":[{"name":"schema"}]}
  206. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ008"},{"typ":"M","value":"no schema on the search path exists: nonexistant"}]}
  207. DataRow {"fields":["NULL"]}
  208. CommandComplete {"tag":"SELECT 1"}
  209. ReadyForQuery {"status":"I"}
  210. CommandComplete {"tag":"SET"}
  211. ReadyForQuery {"status":"I"}
  212. RowDescription {"fields":[{"name":"schema"}]}
  213. DataRow {"fields":["public"]}
  214. CommandComplete {"tag":"SELECT 1"}
  215. ReadyForQuery {"status":"I"}
  216. CommandComplete {"tag":"SET"}
  217. ReadyForQuery {"status":"I"}
  218. CommandComplete {"tag":"SET"}
  219. ReadyForQuery {"status":"I"}
  220. CommandComplete {"tag":"SET"}
  221. ReadyForQuery {"status":"I"}
  222. RowDescription {"fields":[{"name":"schema"}]}
  223. DataRow {"fields":["public"]}
  224. CommandComplete {"tag":"SELECT 1"}
  225. ReadyForQuery {"status":"I"}
  226. CommandComplete {"tag":"SET"}
  227. ReadyForQuery {"status":"I"}
  228. RowDescription {"fields":[{"name":"schema"}]}
  229. DataRow {"fields":["public"]}
  230. CommandComplete {"tag":"SELECT 1"}
  231. ReadyForQuery {"status":"I"}
  232. CommandComplete {"tag":"SET"}
  233. ReadyForQuery {"status":"I"}
  234. RowDescription {"fields":[{"name":"schema"}]}
  235. DataRow {"fields":["public"]}
  236. CommandComplete {"tag":"SELECT 1"}
  237. ReadyForQuery {"status":"I"}
  238. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ007"},{"typ":"M","value":"cluster \"nonexistant\" does not exist"}]}
  239. CommandComplete {"tag":"SET"}
  240. ReadyForQuery {"status":"I"}
  241. RowDescription {"fields":[{"name":"cluster"}]}
  242. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ007"},{"typ":"M","value":"cluster \"nonexistant\" does not exist"}]}
  243. DataRow {"fields":["nonexistant"]}
  244. CommandComplete {"tag":"SELECT 1"}
  245. ReadyForQuery {"status":"I"}
  246. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ007"},{"typ":"M","value":"cluster \"nonexistant2\" does not exist"}]}
  247. CommandComplete {"tag":"SET"}
  248. ReadyForQuery {"status":"I"}
  249. RowDescription {"fields":[{"name":"cluster"}]}
  250. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ007"},{"typ":"M","value":"cluster \"nonexistant2\" does not exist"}]}
  251. DataRow {"fields":["nonexistant2"]}
  252. CommandComplete {"tag":"SELECT 1"}
  253. ReadyForQuery {"status":"I"}
  254. CommandComplete {"tag":"SET"}
  255. ReadyForQuery {"status":"I"}
  256. RowDescription {"fields":[{"name":"cluster"}]}
  257. DataRow {"fields":["quickstart"]}
  258. CommandComplete {"tag":"SELECT 1"}
  259. ReadyForQuery {"status":"I"}
  260. # Test dropping active database
  261. send
  262. Query {"query": "create database d1"}
  263. Query {"query": "create database d2"}
  264. Query {"query": "create database DB3"}
  265. Query {"query": "set database = d1"}
  266. Query {"query": "drop database d2"}
  267. Query {"query": "drop database d1"}
  268. Query {"query": "set database = dB3"}
  269. Query {"query": "show database"}
  270. Query {"query": "drop DATABASE Db3"}
  271. Query {"query": "create database d4"}
  272. Query {"query": "set database = d4"}
  273. Query {"query": "drop owned by materialize"}
  274. ----
  275. until
  276. ReadyForQuery
  277. ReadyForQuery
  278. ReadyForQuery
  279. ReadyForQuery
  280. ReadyForQuery
  281. ReadyForQuery
  282. ReadyForQuery
  283. ReadyForQuery
  284. ReadyForQuery
  285. ReadyForQuery
  286. ReadyForQuery
  287. ReadyForQuery
  288. ----
  289. CommandComplete {"tag":"CREATE DATABASE"}
  290. ReadyForQuery {"status":"I"}
  291. CommandComplete {"tag":"CREATE DATABASE"}
  292. ReadyForQuery {"status":"I"}
  293. CommandComplete {"tag":"CREATE DATABASE"}
  294. ReadyForQuery {"status":"I"}
  295. CommandComplete {"tag":"SET"}
  296. ReadyForQuery {"status":"I"}
  297. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"00000"},{"typ":"M","value":"drop cascades to 1 other objects"}]}
  298. CommandComplete {"tag":"DROP DATABASE"}
  299. ReadyForQuery {"status":"I"}
  300. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"00000"},{"typ":"M","value":"drop cascades to 1 other objects"}]}
  301. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ002"},{"typ":"M","value":"active database \"d1\" has been dropped"}]}
  302. CommandComplete {"tag":"DROP DATABASE"}
  303. ReadyForQuery {"status":"I"}
  304. CommandComplete {"tag":"SET"}
  305. ReadyForQuery {"status":"I"}
  306. RowDescription {"fields":[{"name":"database"}]}
  307. DataRow {"fields":["db3"]}
  308. CommandComplete {"tag":"SELECT 1"}
  309. ReadyForQuery {"status":"I"}
  310. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"00000"},{"typ":"M","value":"drop cascades to 1 other objects"}]}
  311. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ002"},{"typ":"M","value":"active database \"db3\" has been dropped"}]}
  312. CommandComplete {"tag":"DROP DATABASE"}
  313. ReadyForQuery {"status":"I"}
  314. CommandComplete {"tag":"CREATE DATABASE"}
  315. ReadyForQuery {"status":"I"}
  316. CommandComplete {"tag":"SET"}
  317. ReadyForQuery {"status":"I"}
  318. NoticeResponse {"fields":[{"typ":"S","value":"WARNING"},{"typ":"C","value":"01006"},{"typ":"M","value":"no privileges could be revoked for CLUSTER \"quickstart\""}]}
  319. NoticeResponse {"fields":[{"typ":"S","value":"WARNING"},{"typ":"C","value":"01006"},{"typ":"M","value":"no privileges could be revoked for DATABASE \"materialize\""}]}
  320. NoticeResponse {"fields":[{"typ":"S","value":"WARNING"},{"typ":"C","value":"01006"},{"typ":"M","value":"no privileges could be revoked for SCHEMA \"materialize.public\""}]}
  321. NoticeResponse {"fields":[{"typ":"S","value":"WARNING"},{"typ":"C","value":"01006"},{"typ":"M","value":"no privileges could be revoked for SYSTEM"}]}
  322. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ002"},{"typ":"M","value":"active database \"d4\" has been dropped"}]}
  323. CommandComplete {"tag":"DROP OWNED"}
  324. ReadyForQuery {"status":"I"}
  325. # Test dropping active cluster
  326. send
  327. Query {"query": "create cluster c1 REPLICAS ()"}
  328. Query {"query": "create cluster c2 REPLICAS ()"}
  329. Query {"query": "create cluster CL3 REPLICAS (r1 (SIZE = '1'))"}
  330. Query {"query": "set cluster = c1"}
  331. Query {"query": "drop cluster c2"}
  332. Query {"query": "drop cluster c1"}
  333. Query {"query": "set cluster = cL3"}
  334. Query {"query": "show cluster"}
  335. Query {"query": "drop CLUSTER Cl3"}
  336. Query {"query": "create cluster c4 REPLICAS ()"}
  337. Query {"query": "set cluster = c4"}
  338. Query {"query": "drop owned by materialize"}
  339. ----
  340. until
  341. ReadyForQuery
  342. ReadyForQuery
  343. ReadyForQuery
  344. ReadyForQuery
  345. ReadyForQuery
  346. ReadyForQuery
  347. ReadyForQuery
  348. ReadyForQuery
  349. ReadyForQuery
  350. ReadyForQuery
  351. ReadyForQuery
  352. ReadyForQuery
  353. ----
  354. CommandComplete {"tag":"CREATE CLUSTER"}
  355. ReadyForQuery {"status":"I"}
  356. CommandComplete {"tag":"CREATE CLUSTER"}
  357. ReadyForQuery {"status":"I"}
  358. CommandComplete {"tag":"CREATE CLUSTER"}
  359. ReadyForQuery {"status":"I"}
  360. CommandComplete {"tag":"SET"}
  361. ReadyForQuery {"status":"I"}
  362. CommandComplete {"tag":"DROP CLUSTER"}
  363. ReadyForQuery {"status":"I"}
  364. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ003"},{"typ":"M","value":"active cluster \"c1\" has been dropped"}]}
  365. CommandComplete {"tag":"DROP CLUSTER"}
  366. ReadyForQuery {"status":"I"}
  367. CommandComplete {"tag":"SET"}
  368. ReadyForQuery {"status":"I"}
  369. RowDescription {"fields":[{"name":"cluster"}]}
  370. DataRow {"fields":["cl3"]}
  371. CommandComplete {"tag":"SELECT 1"}
  372. ReadyForQuery {"status":"I"}
  373. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"00000"},{"typ":"M","value":"drop cascades to 1 other objects"}]}
  374. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ003"},{"typ":"M","value":"active cluster \"cl3\" has been dropped"}]}
  375. CommandComplete {"tag":"DROP CLUSTER"}
  376. ReadyForQuery {"status":"I"}
  377. CommandComplete {"tag":"CREATE CLUSTER"}
  378. ReadyForQuery {"status":"I"}
  379. CommandComplete {"tag":"SET"}
  380. ReadyForQuery {"status":"I"}
  381. NoticeResponse {"fields":[{"typ":"S","value":"WARNING"},{"typ":"C","value":"01006"},{"typ":"M","value":"no privileges could be revoked for CLUSTER \"quickstart\""}]}
  382. NoticeResponse {"fields":[{"typ":"S","value":"WARNING"},{"typ":"C","value":"01006"},{"typ":"M","value":"no privileges could be revoked for DATABASE \"materialize\""}]}
  383. NoticeResponse {"fields":[{"typ":"S","value":"WARNING"},{"typ":"C","value":"01006"},{"typ":"M","value":"no privileges could be revoked for SCHEMA \"materialize.public\""}]}
  384. NoticeResponse {"fields":[{"typ":"S","value":"WARNING"},{"typ":"C","value":"01006"},{"typ":"M","value":"no privileges could be revoked for SYSTEM"}]}
  385. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"MZ003"},{"typ":"M","value":"active cluster \"c4\" has been dropped"}]}
  386. CommandComplete {"tag":"DROP OWNED"}
  387. ReadyForQuery {"status":"I"}
  388. # AlterNoop
  389. send
  390. Query {"query": "CREATE ROLE joe"}
  391. Query {"query": "ALTER CLUSTER IF EXISTS foo OWNER TO joe"}
  392. Query {"query": "ALTER CLUSTER REPLICA IF EXISTS quickstart.quickstart RENAME TO bar_foo"}
  393. ----
  394. until
  395. ReadyForQuery
  396. ReadyForQuery
  397. ReadyForQuery
  398. ----
  399. CommandComplete {"tag":"CREATE ROLE"}
  400. ReadyForQuery {"status":"I"}
  401. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"42704"},{"typ":"M","value":"CLUSTER \"foo\" does not exist, skipping"}]}
  402. CommandComplete {"tag":"ALTER CLUSTER"}
  403. ReadyForQuery {"status":"I"}
  404. NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"42704"},{"typ":"M","value":"CLUSTER REPLICA \"quickstart.quickstart\" does not exist, skipping"}]}
  405. CommandComplete {"tag":"ALTER CLUSTER REPLICA"}
  406. ReadyForQuery {"status":"I"}