Reputation: 1563
I have .net application which is trying to get data dump using pg_dump and restore using pg_restore.
Here is my data dump code:
public string GetStringArgument()
{
return string.Format("-i -h {0} -p {1} -U {2} -F c -b -v -f {3} -n {4} {5}", _dbCredential.Server, _dbCredential.Port.ToString(), _dbCredential.User, GetFilename(), "public", _dbCredential.Database);
}
I'm getting all datatables on public schema.
Now I need to restore this data dump on my postgres server using pg_restore.
public string GetStringArgument()
{
return string.Format("-i -h {0} -p {1} -U {2} -d {3} {4}", _dbCredential.Server, _dbCredential.Port.ToString(), _dbCredential.User, _dbCredential.Database, _dbCredential.BackUpPath);
}
But I need to restore this data bump to different data schema called stack.
This is windows service application and I cann't do any manual script changes.
how can I restore my data dump into different schema ?
Appreciate your feedback!!
Upvotes: 0
Views: 862
Reputation: 1563
There is no way to restore to different schema using pg_restore
All I can do is restore to default schema(whatever the schema which you got from data base) and rename it.
Upvotes: 0