mirror of
https://github.com/postgres/postgres.git
synced 2026-04-21 14:19:26 -04:00
Fix pg_dump for CREATE FOREIGN DATA WRAPPER ... CONNECTION.
Discussion: https://postgr.es/m/7eb0c03b4312b32cb76d340023b39a751745a1f9.camel@j-davis.com
This commit is contained in:
parent
29bf4ee749
commit
b71bf3b845
2 changed files with 15 additions and 1 deletions
|
|
@ -10530,6 +10530,7 @@ getForeignDataWrappers(Archive *fout)
|
|||
int i_fdwowner;
|
||||
int i_fdwhandler;
|
||||
int i_fdwvalidator;
|
||||
int i_fdwconnection;
|
||||
int i_fdwacl;
|
||||
int i_acldefault;
|
||||
int i_fdwoptions;
|
||||
|
|
@ -10539,7 +10540,14 @@ getForeignDataWrappers(Archive *fout)
|
|||
appendPQExpBufferStr(query, "SELECT tableoid, oid, fdwname, "
|
||||
"fdwowner, "
|
||||
"fdwhandler::pg_catalog.regproc, "
|
||||
"fdwvalidator::pg_catalog.regproc, "
|
||||
"fdwvalidator::pg_catalog.regproc, ");
|
||||
|
||||
if (fout->remoteVersion >= 190000)
|
||||
appendPQExpBufferStr(query, "fdwconnection::pg_catalog.regproc, ");
|
||||
else
|
||||
appendPQExpBufferStr(query, "'-' AS fdwconnection, ");
|
||||
|
||||
appendPQExpBufferStr(query,
|
||||
"fdwacl, "
|
||||
"acldefault('F', fdwowner) AS acldefault, "
|
||||
"array_to_string(ARRAY("
|
||||
|
|
@ -10562,6 +10570,7 @@ getForeignDataWrappers(Archive *fout)
|
|||
i_fdwowner = PQfnumber(res, "fdwowner");
|
||||
i_fdwhandler = PQfnumber(res, "fdwhandler");
|
||||
i_fdwvalidator = PQfnumber(res, "fdwvalidator");
|
||||
i_fdwconnection = PQfnumber(res, "fdwconnection");
|
||||
i_fdwacl = PQfnumber(res, "fdwacl");
|
||||
i_acldefault = PQfnumber(res, "acldefault");
|
||||
i_fdwoptions = PQfnumber(res, "fdwoptions");
|
||||
|
|
@ -10581,6 +10590,7 @@ getForeignDataWrappers(Archive *fout)
|
|||
fdwinfo[i].rolname = getRoleName(PQgetvalue(res, i, i_fdwowner));
|
||||
fdwinfo[i].fdwhandler = pg_strdup(PQgetvalue(res, i, i_fdwhandler));
|
||||
fdwinfo[i].fdwvalidator = pg_strdup(PQgetvalue(res, i, i_fdwvalidator));
|
||||
fdwinfo[i].fdwconnection = pg_strdup(PQgetvalue(res, i, i_fdwconnection));
|
||||
fdwinfo[i].fdwoptions = pg_strdup(PQgetvalue(res, i, i_fdwoptions));
|
||||
|
||||
/* Decide whether we want to dump it */
|
||||
|
|
@ -16224,6 +16234,9 @@ dumpForeignDataWrapper(Archive *fout, const FdwInfo *fdwinfo)
|
|||
if (strcmp(fdwinfo->fdwvalidator, "-") != 0)
|
||||
appendPQExpBuffer(q, " VALIDATOR %s", fdwinfo->fdwvalidator);
|
||||
|
||||
if (strcmp(fdwinfo->fdwconnection, "-") != 0)
|
||||
appendPQExpBuffer(q, " CONNECTION %s", fdwinfo->fdwconnection);
|
||||
|
||||
if (strlen(fdwinfo->fdwoptions) > 0)
|
||||
appendPQExpBuffer(q, " OPTIONS (\n %s\n)", fdwinfo->fdwoptions);
|
||||
|
||||
|
|
|
|||
|
|
@ -605,6 +605,7 @@ typedef struct _fdwInfo
|
|||
const char *rolname;
|
||||
char *fdwhandler;
|
||||
char *fdwvalidator;
|
||||
char *fdwconnection;
|
||||
char *fdwoptions;
|
||||
} FdwInfo;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue