subscribe_outputs.slt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. simple conn=mz_system,user=mz_system
  11. ALTER SYSTEM SET enable_envelope_debezium_in_subscribe = true
  12. ----
  13. COMPLETE 0
  14. simple conn=mz_system,user=mz_system
  15. ALTER SYSTEM SET enable_within_timestamp_order_by_in_subscribe = true
  16. ----
  17. COMPLETE 0
  18. statement ok
  19. CREATE TABLE t (a int, b int)
  20. statement ok
  21. CREATE TABLE t2 (a int, b int, c int)
  22. statement ok
  23. BEGIN
  24. statement ok
  25. DECLARE c CURSOR FOR SUBSCRIBE t
  26. query IIII colnames
  27. FETCH 0 c
  28. ----
  29. mz_timestamp mz_diff a b
  30. statement ok
  31. COMMIT
  32. statement ok
  33. BEGIN
  34. statement ok
  35. DECLARE c CURSOR FOR SUBSCRIBE t WITH (PROGRESS)
  36. query IIIII colnames
  37. FETCH 0 c
  38. ----
  39. mz_timestamp mz_progressed mz_diff a b
  40. statement ok
  41. COMMIT
  42. # ENVELOPE UPSERT
  43. statement ok
  44. BEGIN
  45. statement ok
  46. DECLARE c CURSOR FOR SUBSCRIBE t ENVELOPE UPSERT (KEY (a))
  47. query IIII colnames
  48. FETCH 0 c
  49. ----
  50. mz_timestamp mz_state a b
  51. statement ok
  52. COMMIT
  53. statement ok
  54. BEGIN
  55. statement ok
  56. DECLARE c CURSOR FOR SUBSCRIBE t WITH (PROGRESS) ENVELOPE UPSERT (KEY (a))
  57. query IIIII colnames
  58. FETCH 0 c
  59. ----
  60. mz_timestamp mz_progressed mz_state a b
  61. statement ok
  62. COMMIT
  63. statement ok
  64. BEGIN
  65. statement ok
  66. DECLARE c CURSOR FOR SUBSCRIBE t ENVELOPE UPSERT (KEY (a)) WITH (PROGRESS)
  67. query IIIII colnames
  68. FETCH 0 c
  69. ----
  70. mz_timestamp mz_progressed mz_state a b
  71. statement ok
  72. COMMIT
  73. statement ok
  74. BEGIN
  75. statement ok
  76. DECLARE c CURSOR FOR SUBSCRIBE t ENVELOPE UPSERT (KEY (b))
  77. query IIII colnames
  78. FETCH 0 c
  79. ----
  80. mz_timestamp mz_state b a
  81. statement ok
  82. COMMIT
  83. # ENVELOPE DEBEZIUM
  84. statement ok
  85. BEGIN
  86. statement ok
  87. DECLARE c CURSOR FOR SUBSCRIBE t ENVELOPE DEBEZIUM (KEY (a))
  88. query IIIII colnames
  89. FETCH 0 c
  90. ----
  91. mz_timestamp mz_state a before_b after_b
  92. statement ok
  93. COMMIT
  94. statement ok
  95. BEGIN
  96. statement ok
  97. DECLARE c CURSOR FOR SUBSCRIBE t WITH (PROGRESS) ENVELOPE DEBEZIUM (KEY (a))
  98. query IIIIII colnames
  99. FETCH 0 c
  100. ----
  101. mz_timestamp mz_progressed mz_state a before_b after_b
  102. statement ok
  103. COMMIT
  104. statement ok
  105. BEGIN
  106. statement ok
  107. DECLARE c CURSOR FOR SUBSCRIBE t ENVELOPE DEBEZIUM (KEY (b))
  108. query IIIII colnames
  109. FETCH 0 c
  110. ----
  111. mz_timestamp mz_state b before_a after_a
  112. statement ok
  113. COMMIT
  114. statement ok
  115. BEGIN
  116. statement ok
  117. DECLARE c CURSOR FOR SUBSCRIBE t2 ENVELOPE DEBEZIUM (KEY (b))
  118. query IIIIIII colnames
  119. FETCH 0 c
  120. ----
  121. mz_timestamp mz_state b before_a before_c after_a after_c
  122. statement ok
  123. COMMIT
  124. statement ok
  125. BEGIN
  126. statement ok
  127. DECLARE c CURSOR FOR SUBSCRIBE t2 ENVELOPE DEBEZIUM (KEY (c, b))
  128. query IIIIII colnames
  129. FETCH 0 c
  130. ----
  131. mz_timestamp mz_state c b before_a after_a
  132. statement ok
  133. COMMIT
  134. # WITHIN TIMESTAMP ORDER BY
  135. statement ok
  136. BEGIN
  137. statement ok
  138. DECLARE c CURSOR FOR SUBSCRIBE t WITHIN TIMESTAMP ORDER BY a, mz_diff
  139. query IIII colnames
  140. FETCH 0 c
  141. ----
  142. mz_timestamp mz_diff a b
  143. statement ok
  144. COMMIT
  145. statement ok
  146. BEGIN
  147. statement ok
  148. DECLARE c CURSOR FOR SUBSCRIBE t WITH (PROGRESS) WITHIN TIMESTAMP ORDER BY a, mz_diff
  149. query IIIII colnames
  150. FETCH 0 c
  151. ----
  152. mz_timestamp mz_progressed mz_diff a b
  153. statement ok
  154. COMMIT
  155. # SHOW commands are not allowed in maintained (i.e., non-one-shot) dataflows, but SUBSCRIBE _does_ allow it, even though
  156. # it's a maintained dataflow.
  157. statement ok
  158. BEGIN
  159. statement ok
  160. DECLARE c2 CURSOR FOR SUBSCRIBE TO (SHOW CLUSTER REPLICAS);
  161. statement ok
  162. COMMIT