subsource-resolution-duplicates.td 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. # IMPORTANT: The Postgres server has a custom pg_hba.conf that only
  10. # accepts connections from specific users. You will have to update
  11. # pg_hba.conf if you modify the existing user names or add new ones.
  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. CREATE SCHEMA public;
  23. DROP SCHEMA IF EXISTS other CASCADE;
  24. CREATE SCHEMA other;
  25. DROP PUBLICATION IF EXISTS mz_source;
  26. CREATE PUBLICATION mz_source FOR ALL TABLES;
  27. CREATE TABLE t (f1 INT);
  28. INSERT INTO t VALUES (1);
  29. ALTER TABLE t REPLICA IDENTITY FULL;
  30. CREATE TABLE other.t (f1 INT);
  31. INSERT INTO other.t VALUES (1);
  32. ALTER TABLE other.t REPLICA IDENTITY FULL;
  33. > CREATE SOURCE mz_source FROM POSTGRES CONNECTION pg (PUBLICATION 'mz_source');
  34. ! CREATE TABLE t FROM SOURCE mz_source (REFERENCE t);
  35. contains: reference t is ambiguous
  36. > CREATE TABLE t FROM SOURCE mz_source (REFERENCE public.t);
  37. ! CREATE TABLE t FROM SOURCE mz_source (REFERENCE other.t);
  38. contains:catalog item 't' already exists
  39. > CREATE TABLE t2 FROM SOURCE mz_source (REFERENCE other.t);
  40. > DROP TABLE t;
  41. > CREATE TABLE x FROM SOURCE mz_source (REFERENCE public.t);
  42. # multiple subsources may refer to the same table postgres.public.t
  43. > CREATE TABLE Y FROM SOURCE mz_source (REFERENCE public.t);
  44. > DROP TABLE x;
  45. > CREATE TABLE t FROM SOURCE mz_source (REFERENCE other.t);
  46. > SHOW sources
  47. mz_source postgres quickstart ""
  48. mz_source_progress progress <null> ""
  49. > SHOW TABLES
  50. t ""
  51. t2 ""
  52. y ""
  53. $ postgres-execute connection=postgres://postgres:postgres@postgres
  54. DROP SCHEMA other CASCADE;
  55. # TODO: database-issues#8708
  56. # > SET statement_timeout = '5s'
  57. # ! SELECT * FROM t
  58. # contains:statement timeout