discard.slt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. # Start from a pristine server
  11. reset-server
  12. query T
  13. SHOW cluster
  14. ----
  15. quickstart
  16. simple conn=mz_system,user=mz_system
  17. ALTER SYSTEM SET cluster TO foo;
  18. ----
  19. COMPLETE 0
  20. statement ok
  21. CREATE ROLE parker;
  22. simple conn=parker_1,user=parker
  23. SHOW cluster;
  24. ----
  25. foo
  26. COMPLETE 1
  27. simple conn=parker_1,user=parker
  28. SET cluster TO bar;
  29. ----
  30. COMPLETE 0
  31. simple conn=parker_1,user=parker
  32. SHOW cluster;
  33. ----
  34. bar
  35. COMPLETE 1
  36. simple conn=parker_1,user=parker
  37. DISCARD ALL;
  38. ----
  39. COMPLETE 0
  40. # After DISCARD ALL we should still respect the system default.
  41. simple conn=parker_1,user=parker
  42. SHOW cluster;
  43. ----
  44. foo
  45. COMPLETE 1
  46. simple conn=parker_1,user=parker
  47. ALTER ROLE parker SET cluster TO baz;
  48. ----
  49. COMPLETE 0
  50. # Use a new connection.
  51. simple conn=parker_2,user=parker
  52. SHOW cluster
  53. ----
  54. baz
  55. COMPLETE 1
  56. simple conn=parker_2,user=parker
  57. SET cluster TO other_other;
  58. ----
  59. COMPLETE 0
  60. simple conn=parker_2,user=parker
  61. SHOW cluster
  62. ----
  63. other_other
  64. COMPLETE 1
  65. simple conn=parker_2,user=parker
  66. DISCARD ALL;
  67. ----
  68. COMPLETE 0
  69. # After DISCARD ALL we should still respect the Role default.
  70. simple conn=parker_2,user=parker
  71. SHOW cluster
  72. ----
  73. baz
  74. COMPLETE 1