subsource-resolution-empty.td 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #
  10. # Tests that empty publication and missing for tables clauses errors correctly
  11. #
  12. > CREATE SECRET pgpass AS 'postgres'
  13. > CREATE CONNECTION pg TO POSTGRES (
  14. HOST postgres,
  15. DATABASE postgres,
  16. USER postgres,
  17. PASSWORD SECRET pgpass
  18. )
  19. $ postgres-execute connection=postgres://postgres:postgres@postgres
  20. ALTER USER postgres WITH replication;
  21. DROP SCHEMA IF EXISTS public CASCADE;
  22. DROP PUBLICATION IF EXISTS mz_source;
  23. CREATE SCHEMA public;
  24. DROP SCHEMA IF EXISTS other CASCADE;
  25. CREATE SCHEMA other;
  26. DROP PUBLICATION IF EXISTS mz_source_empty;
  27. CREATE PUBLICATION mz_source_empty;
  28. DROP PUBLICATION IF EXISTS mz_source;
  29. CREATE PUBLICATION mz_source FOR ALL TABLES;
  30. CREATE TABLE t (f1 int);
  31. ALTER TABLE t REPLICA IDENTITY FULL;
  32. ! CREATE SOURCE "mz_source_empty"
  33. FROM POSTGRES CONNECTION pg (PUBLICATION 'mz_source_empty')
  34. FOR ALL TABLES;
  35. contains:PUBLICATION mz_source_empty is empty
  36. ! CREATE SOURCE "mz_source_empty"
  37. FROM POSTGRES CONNECTION pg (PUBLICATION 'mz_source_empty')
  38. FOR TABLES (t1);
  39. contains:PUBLICATION mz_source_empty is empty
  40. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  41. ALTER SYSTEM SET enable_create_table_from_source = false
  42. ! CREATE SOURCE "mz_source_empty"
  43. FROM POSTGRES CONNECTION pg (PUBLICATION mz_source);
  44. contains:missing TABLES specification
  45. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  46. ALTER SYSTEM SET enable_create_table_from_source = true
  47. ! CREATE SOURCE mz_source
  48. FROM POSTGRES CONNECTION pg (PUBLICATION mz_source)
  49. FOR SCHEMAS (dne);
  50. contains:no tables found in referenced schemas: "dne"
  51. $ postgres-execute connection=postgres://postgres:postgres@postgres
  52. DROP SCHEMA other CASCADE;