pg-cdc.td 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. > CREATE SECRET pgpass AS 'postgres'
  10. > CREATE CONNECTION pg TO POSTGRES (
  11. HOST postgres,
  12. DATABASE postgres,
  13. USER postgres,
  14. PASSWORD SECRET pgpass
  15. )
  16. $ postgres-execute connection=postgres://postgres:postgres@postgres
  17. ALTER USER postgres WITH replication;
  18. DROP SCHEMA IF EXISTS public CASCADE;
  19. CREATE SCHEMA public;
  20. DROP PUBLICATION IF EXISTS mz_source;
  21. CREATE PUBLICATION mz_source FOR ALL TABLES;
  22. CREATE TABLE t (f1 TEXT);
  23. INSERT INTO t VALUES ('ghp_9fK8sL3x7TqR1vEzYm2pDaN4WjXbQzUtV0aN');
  24. ALTER TABLE t REPLICA IDENTITY FULL;
  25. > CREATE SOURCE pg_source
  26. FROM POSTGRES CONNECTION pg (PUBLICATION 'mz_source');
  27. > CREATE TABLE t FROM SOURCE pg_source (REFERENCE t);
  28. > SELECT * FROM t
  29. ghp_9fK8sL3x7TqR1vEzYm2pDaN4WjXbQzUtV0aN