Skip to content

Commit

Permalink
Do not dump default babelfishpg_telemetry schema (babelfish-for-postg…
Browse files Browse the repository at this point in the history
…resql#226)

Skip dumping default babelfishpg_telemetry schema as it would
already exists on the target server.

Signed-off-by: Rishabh Tanwar [email protected]
  • Loading branch information
rishabhtanwar29 authored and deepakshi-mittal committed Oct 9, 2023
1 parent df30c57 commit 4f0e40e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/bin/pg_dump/dump_babel_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,24 @@ bbf_selectDumpableObject(DumpableObject *dobj, Archive *fout)
if (fout->dopt->binary_upgrade)
return;

/* Do not dump the definition of default babelfish schemas */
/*
* Do not dump the definition of default babelfish schemas but
* their contained objects will be dumped.
*/
if (strcmp(nsinfo->dobj.name, "master_dbo") == 0 ||
strcmp(nsinfo->dobj.name, "master_guest") == 0 ||
strcmp(nsinfo->dobj.name, "msdb_dbo") == 0 ||
strcmp(nsinfo->dobj.name, "msdb_guest") == 0 ||
strcmp(nsinfo->dobj.name, "tempdb_dbo") == 0 ||
strcmp(nsinfo->dobj.name, "tempdb_guest") == 0)
nsinfo->dobj.dump &= ~DUMP_COMPONENT_DEFINITION;

/*
* Do not dump any components of the schemas which get created as
* part of CREATE EXTENSION babelfish... command.
*/
if (strcmp(nsinfo->dobj.name, "babelfishpg_telemetry") == 0)
nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
}
break;
case DO_EXTENSION:
Expand All @@ -415,7 +425,7 @@ bbf_selectDumpableObject(DumpableObject *dobj, Archive *fout)
return;

if (strncmp(extinfo->dobj.name, "babelfishpg", 11) == 0)
extinfo->dobj.dump &= ~DUMP_COMPONENT_DEFINITION;
extinfo->dobj.dump = extinfo->dobj.dump_contains = DUMP_COMPONENT_NONE;
}
break;
case DO_FUNC:
Expand Down

0 comments on commit 4f0e40e

Please sign in to comment.