Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CREATE SOURCE ... FROM POSTGRES CONNECTION should fail for a yugabyte connection #29667

Open
def- opened this issue Sep 19, 2024 · 0 comments
Open
Assignees
Labels
C-bug Category: something is broken T-sources Theme: Sources

Comments

@def-
Copy link
Contributor

def- commented Sep 19, 2024

What version of Materialize are you using?

main

What is the issue?

Probably also related to #29658:

> CREATE SECRET pgpass AS 'yugabyte'
> CREATE CONNECTION pg TO YUGABYTE (
    HOST yugabyte,
    PORT 5433,
    DATABASE yugabyte,
    USER yugabyte,
    PASSWORD SECRET pgpass
  )

$ postgres-execute connection=postgres://yugabyte:yugabyte@yugabyte:5433/yugabyte
ALTER USER yugabyte WITH replication;
DROP SCHEMA IF EXISTS public CASCADE;
DROP PUBLICATION IF EXISTS mz_source;
CREATE SCHEMA public;
CREATE TABLE add_columns (f1 INTEGER);
ALTER TABLE add_columns REPLICA IDENTITY FULL;
INSERT INTO add_columns VALUES (1);
CREATE TABLE remove_column (f1 INTEGER, f2 VARCHAR(2));
ALTER TABLE remove_column REPLICA IDENTITY FULL;
INSERT INTO remove_column VALUES (2, 'ab');
CREATE PUBLICATION mz_source FOR ALL TABLES;

> CREATE SOURCE mz_source
  FROM POSTGRES CONNECTION pg (PUBLICATION 'mz_source')
  FOR ALL TABLES;

Fails:

alter-table-after-source.td:109:1: error: executing query failed: db error: ERROR: POSTGRES source validation: PUBLICATION mz_source is empty: ERROR: POSTGRES source validation: PUBLICATION mz_source is empty
     |
  14 | > CREATE SECRET pgpa ... [rest of line truncated for security]
  20 |     PASSWORD SECRET  ... [rest of line truncated for security]
  23 | $ postgres-execute c ... [rest of line truncated for security]
 108 |
 109 | > CREATE SOURCE mz_source
     | ^

The mistake is that it should be YUGABYTE CONNECTION instead of POSTGRES CONNECTION:

> CREATE SOURCE mz_source
  FROM YUGABYTE CONNECTION pg (PUBLICATION 'mz_source')
  FOR ALL TABLES;

I believe we should error out and not treat the connection as a connection to postgres.

@def- def- added C-bug Category: something is broken T-sources Theme: Sources labels Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: something is broken T-sources Theme: Sources
Projects
None yet
Development

No branches or pull requests

2 participants