publication-for-table.td 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. # Test that a publication that does not cover all tables is handled 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. CREATE TABLE t1 (f1 INTEGER);
  25. ALTER TABLE t1 REPLICA IDENTITY FULL;
  26. INSERT INTO t1 VALUES (1);
  27. CREATE TABLE t2 (f1 INTEGER);
  28. ALTER TABLE t2 REPLICA IDENTITY FULL;
  29. INSERT INTO t2 VALUES (5);
  30. CREATE PUBLICATION mz_source FOR TABLE t1;
  31. > CREATE SOURCE mz_source
  32. FROM POSTGRES CONNECTION pg (PUBLICATION 'mz_source')
  33. FOR TABLES (t1);
  34. > SELECT * FROM t1;
  35. 1
  36. > DROP SOURCE mz_source CASCADE;
  37. ! CREATE SOURCE mz_source
  38. FROM POSTGRES CONNECTION pg (PUBLICATION 'mz_source')
  39. FOR TABLES (t2);
  40. contains:reference to t2 not found in source