Skip to content

postgres_attach() error when connecting to read-only replica #90

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

Closed
loicalleyne opened this issue Mar 23, 2023 · 4 comments · Fixed by #112
Closed

postgres_attach() error when connecting to read-only replica #90

loicalleyne opened this issue Mar 23, 2023 · 4 comments · Fixed by #112

Comments

@loicalleyne
Copy link

I'm trying to connect to a postgres read-only replica and getting the following error. The replica is using log shipping to prevent replication delays from cascading up to the master DB in production.

call postgres_attach('host=< IP address > port=5432 user=< USER > dbname=< DB NAME > sslmode=require', source_schema='public', sink_schema='abc');
Error: IO Error: Unable to query Postgres: ERROR:  cannot assign TransactionIds during recovery
 ERROR:  cannot assign TransactionIds during recovery

Is this something that can be supported with the pg library being used? Connecting to the same DB from the same machine with psql works fine.

@seanabraham
Copy link

Seeing the exact same issue with a postgres read replica, I don't have much to add except that the same error occurs with a SELECT * from postgres_scan(...) as well.

Mytherin added a commit to Mytherin/duckdb-postgres that referenced this issue Oct 17, 2023
Mytherin added a commit that referenced this issue Oct 18, 2023
Fix #90 - disable parallel scans for read-only replicas
@Mytherin
Copy link
Contributor

Thanks for the report! This should be addressed in #112. I've tested this with a read-replica through AWS RDS but it would be great if you could verify that it resolves the issue.

@seanabraham
Copy link

Amazing, thank you @Mytherin. How does this get deployed so to speak? I see that DuckDB bundles this extension and presumably this commit hash needs to be bumped: https://github.com/duckdb/duckdb/blob/5ec85a719940a9fade15c38e7601712e9cef58d8/.github/config/extensions.csv#L12

Is there a way to test this version of postgres_scanner locally somehow?

@Mytherin
Copy link
Contributor

You can compile the postgres_scanner by cloning the repo and running make. The extension can then be found in build/release/extension/postgres_scanner/postgres_scanner.duckdb_extension which can be installed using the SQL command:

FORCE INSTALL 'build/release/extension/postgres_scanner/postgres_scanner.duckdb_extension';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants