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

[PostgreSQL] Foreign Tables during the Migration fails in import-schema for server not exist #1627

Open
priyanshi-yb opened this issue Aug 11, 2024 · 0 comments

Comments

@priyanshi-yb
Copy link
Contributor

priyanshi-yb commented Aug 11, 2024

Jira Link: DB-13443
If your source database has FOREIGN tables, then right now Voyager doesn't dump SERVER of that FOREIGN table.

Example -

CREATE EXTENSION postgres_fdw;

CREATE SERVER remote_server                                                                                                                                                       
FOREIGN DATA WRAPPER postgres_fdw                                                                                                                                                         
OPTIONS (host '127.0.0.1', port '5432', dbname 'postgres');

CREATE FOREIGN TABLE foreign_table (                                                                                                                                                  
   id INT,                                                                                                                                                                                       
   name TEXT,                                                                                                                                                                                    
   data JSONB                                                                                                                                                                                
) SERVER remote_server                                                                                                                                                                          OPTIONS (
schema_name 'public', 
table_name 'remote_table'
);

CREATE USER MAPPING FOR postgres                                                                                                                                                
SERVER remote_server                                                                                                                                                                        
OPTIONS (user 'postgres', password 'XXX');

The exported schema will have only -

CREATE FOREIGN TABLE public.foreign_table (                                                                                                                                                  
   id INT,                                                                                                                                                                                       
   name TEXT,                                                                                                                                                                                    
   data JSONB                                                                                                                                                                                
) SERVER remote_server                                                                                                                                                                          OPTIONS (
schema_name 'public', 
table_name 'remote_table'
);

Error in import schema phase -

ERROR: server "remote_server" does not exist (SQLSTATE 42704)

Workaround -

Suggestion is to create the SERVER and its USER MAPPING manually on the target YugabyteDB to get it working.

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

No branches or pull requests

3 participants