replication-slots.td 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. # This test is expected to run with fewer than 4 replication slots.
  10. > CREATE SECRET pgpass AS 'postgres'
  11. > CREATE CONNECTION pg TO POSTGRES (
  12. HOST postgres,
  13. DATABASE postgres,
  14. USER postgres,
  15. PASSWORD SECRET pgpass
  16. )
  17. $ postgres-execute connection=postgres://postgres:postgres@postgres
  18. ALTER USER postgres WITH replication;
  19. DROP SCHEMA IF EXISTS public CASCADE;
  20. CREATE SCHEMA public;
  21. DROP PUBLICATION IF EXISTS mz_source;
  22. CREATE PUBLICATION mz_source FOR ALL TABLES;
  23. CREATE TABLE pk_table (pk INTEGER PRIMARY KEY, f2 TEXT);
  24. INSERT INTO pk_table VALUES (1, 'one');
  25. ALTER TABLE pk_table REPLICA IDENTITY FULL;
  26. INSERT INTO pk_table VALUES (2, 'two');
  27. > CREATE SOURCE pg_source
  28. FROM POSTGRES CONNECTION pg (PUBLICATION 'mz_source');
  29. > CREATE TABLE "pk_table" FROM SOURCE pg_source (REFERENCE "pk_table");
  30. ! CREATE SOURCE pg_source_2
  31. FROM POSTGRES CONNECTION pg (PUBLICATION 'mz_source');
  32. contains:POSTGRES source validation: PostgreSQL server has insufficient number of replication slots available