mz-support-privileges.td 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # Tests that assert the privileges that are assumed to be always granted to #
  11. # the mz_support user. This test can be rewritten to validate the output of the
  12. # `connection=mz_support` command once we have `SET ROLE` working.
  13. $ postgres-connect name=mz_support url=postgres://mz_support:materialize@${testdrive.materialize-internal-sql-addr}
  14. > CREATE SOURCE auction_house
  15. IN CLUSTER ${arg.single-replica-cluster}
  16. FROM LOAD GENERATOR AUCTION (UP TO 100);
  17. > CREATE TABLE accounts FROM SOURCE auction_house (REFERENCE accounts);
  18. > CREATE TABLE auctions FROM SOURCE auction_house (REFERENCE auctions);
  19. > CREATE TABLE bids FROM SOURCE auction_house (REFERENCE bids);
  20. > CREATE TABLE organizations FROM SOURCE auction_house (REFERENCE organizations);
  21. > CREATE TABLE users FROM SOURCE auction_house (REFERENCE users);
  22. > CREATE VIEW v AS SELECT b.auction_id, b.buyer, b.amount, b.bid_time, u.org_id FROM bids b JOIN users u ON(b.buyer = u.id);
  23. # The mz_support user can list database sources.
  24. $ postgres-execute connection=mz_support
  25. SHOW SOURCES;
  26. # The mz_support user can execute `SHOW CREATE ...` commands.
  27. $ postgres-execute connection=mz_support
  28. SHOW CREATE TABLE bids;
  29. # The mz_support user can execute `EXPLAIN PLAN ... FOR SELECT` commands.
  30. $ postgres-execute connection=mz_support
  31. EXPLAIN OPTIMIZED PLAN AS VERBOSE TEXT FOR SELECT b.auction_id, b.buyer, b.amount, b.bid_time, u.org_id FROM bids b JOIN users u ON(b.buyer = u.id);
  32. # The mz_support user can execute `EXPLAIN PLAN ... FOR CREATE MATERIALIZED VIEW` commands.
  33. $ postgres-execute connection=mz_support
  34. EXPLAIN OPTIMIZED PLAN AS VERBOSE TEXT FOR CREATE MATERIALIZED VIEW mv AS SELECT b.auction_id, b.buyer, b.amount, b.bid_time, u.org_id FROM bids b JOIN users u ON(b.buyer = u.id);
  35. # The mz_support user can execute `EXPLAIN PLAN ... FOR CREATE INDEX` commands.
  36. $ postgres-execute connection=mz_support
  37. EXPLAIN OPTIMIZED PLAN AS VERBOSE TEXT FOR CREATE INDEX ON v(auction_id);
  38. # The mz_support user can execute `EXPLAIN TIMESTAMP ...` commands.
  39. $ postgres-execute connection=mz_support
  40. EXPLAIN TIMESTAMP FOR SELECT b.auction_id, b.buyer, b.amount, b.bid_time, u.org_id FROM bids b JOIN users u ON(b.buyer = u.id);
  41. # The mz_support user can filter SHOW commands on user objects.
  42. $ postgres-execute connection=mz_support
  43. SHOW INDEXES ON bids;
  44. > DROP SOURCE auction_house CASCADE;