show-subsources.td 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. $ set-arg-default single-replica-cluster=quickstart
  10. # Create a load generator source that has several subsources.
  11. > CREATE SOURCE lga
  12. IN CLUSTER ${arg.single-replica-cluster}
  13. FROM LOAD GENERATOR AUCTION (UP TO 100);
  14. > CREATE TABLE accounts FROM SOURCE lga (REFERENCE accounts);
  15. > CREATE TABLE auctions FROM SOURCE lga (REFERENCE auctions);
  16. > CREATE TABLE bids FROM SOURCE lga (REFERENCE bids);
  17. > CREATE TABLE organizations FROM SOURCE lga (REFERENCE organizations);
  18. > CREATE TABLE users FROM SOURCE lga (REFERENCE users);
  19. # By default, `SHOW SUBSOURCES` should show all sources in the schema.
  20. > SHOW SUBSOURCES
  21. name type
  22. -------------------------
  23. lga_progress progress
  24. > SHOW TABLES
  25. name comment
  26. -------------------------
  27. accounts ""
  28. auctions ""
  29. bids ""
  30. organizations ""
  31. users ""
  32. # Verify the schema filtering by creating two new sources, one in the current
  33. # schema and one in another schema. Verify that `SHOW SUBSOURCES` shows the
  34. # subsources only in the current schema.
  35. > CREATE SCHEMA other
  36. > CREATE SOURCE lgc
  37. IN CLUSTER ${arg.single-replica-cluster}
  38. FROM LOAD GENERATOR COUNTER (UP TO 100)
  39. > CREATE SOURCE other.lgo
  40. IN CLUSTER ${arg.single-replica-cluster}
  41. FROM LOAD GENERATOR COUNTER (UP TO 100)
  42. > SHOW SUBSOURCES
  43. name type
  44. -------------------------
  45. lga_progress progress
  46. lgc_progress progress
  47. > SHOW TABLES
  48. name comment
  49. -------------------------
  50. accounts ""
  51. auctions ""
  52. bids ""
  53. organizations ""
  54. users ""
  55. > SET SCHEMA = other
  56. > SHOW SUBSOURCES
  57. name type
  58. -------------------------
  59. lgo_progress progress
  60. # Verify that you can override the current schema with `FROM ...`.
  61. > SHOW SUBSOURCES FROM public
  62. name type
  63. -------------------------
  64. lga_progress progress
  65. lgc_progress progress
  66. # Verify that `ON ...` filters to the subsources of the named source.
  67. > SHOW SUBSOURCES ON lgo
  68. name type
  69. -------------------------
  70. lgo_progress progress
  71. # Verify again with a cross-schema reference.
  72. > SHOW SUBSOURCES ON public.lgc
  73. name type
  74. -------------------------
  75. lgc_progress progress
  76. # Verify that you cannot combine a schema filter with a source filter.
  77. ! SHOW SUBSOURCES FROM public ON lga
  78. contains:Cannot specify both FROM and ON
  79. # Verify that `ON` validates that the referenced object is a source.
  80. > CREATE TABLE t (a int)
  81. ! SHOW SUBSOURCES ON t
  82. contains:cannot show subsources on materialize.other.t because it is a table
  83. > DROP SOURCE other.lgo CASCADE