id_reuse.slt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. # Test that cluster ids aren't reused.
  10. mode cockroach
  11. # Requires stable ids
  12. reset-server
  13. statement ok
  14. CREATE SCHEMA foo
  15. query TT rowsort
  16. SELECT id, name FROM mz_schemas
  17. ----
  18. s1 mz_catalog
  19. s2 pg_catalog
  20. u3 public
  21. s4 mz_internal
  22. s5 information_schema
  23. s6 mz_unsafe
  24. s7 mz_catalog_unstable
  25. s8 mz_introspection
  26. u9 foo
  27. statement ok
  28. DROP schema foo
  29. statement ok
  30. DROP SCHEMA IF EXISTS foo, bar
  31. statement ok
  32. CREATE schema bar
  33. query TT rowsort
  34. SELECT id, name FROM mz_schemas
  35. ----
  36. s1 mz_catalog
  37. s2 pg_catalog
  38. u3 public
  39. s4 mz_internal
  40. s5 information_schema
  41. s6 mz_unsafe
  42. s7 mz_catalog_unstable
  43. s8 mz_introspection
  44. u10 bar
  45. statement ok
  46. CREATE DATABASE foo
  47. query TT rowsort
  48. SELECT id, name FROM mz_databases
  49. ----
  50. u1 materialize
  51. u2 foo
  52. statement ok
  53. DROP DATABASE foo
  54. statement ok
  55. CREATE DATABASE bar
  56. query TT rowsort
  57. SELECT id, name FROM mz_databases
  58. ----
  59. u1 materialize
  60. u3 bar
  61. statement ok
  62. CREATE ROLE foo
  63. query TT rowsort
  64. SELECT id, name FROM mz_roles
  65. ----
  66. g1 mz_monitor
  67. g2 mz_monitor_redacted
  68. s1 mz_system
  69. s2 mz_support
  70. s3 mz_analytics
  71. u1 materialize
  72. u2 foo
  73. statement ok
  74. DROP ROLE foo
  75. statement ok
  76. DROP ROLE IF EXISTS foo, bar, foo
  77. statement ok
  78. CREATE ROLE bar
  79. query TT rowsort
  80. SELECT id, name FROM mz_roles
  81. ----
  82. g1 mz_monitor
  83. g2 mz_monitor_redacted
  84. s1 mz_system
  85. s2 mz_support
  86. s3 mz_analytics
  87. u1 materialize
  88. u3 bar
  89. statement ok
  90. CREATE CLUSTER foo REPLICAS (r1 (size '1'))
  91. query TT rowsort
  92. SELECT id, name FROM mz_clusters
  93. ----
  94. s1 mz_system
  95. s2 mz_catalog_server
  96. s3 mz_probe
  97. s4 mz_support
  98. s5 mz_analytics
  99. u1 quickstart
  100. u2 foo
  101. statement ok
  102. DROP CLUSTER foo CASCADE
  103. statement ok
  104. CREATE CLUSTER bar REPLICAS (r1 (size '1'))
  105. query TT rowsort
  106. SELECT id, name FROM mz_clusters
  107. ----
  108. s1 mz_system
  109. s2 mz_catalog_server
  110. s3 mz_probe
  111. s4 mz_support
  112. s5 mz_analytics
  113. u1 quickstart
  114. u3 bar