Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita42fff0

Browse files
committed
WIP. TODO: parse pgpro_remoteversion_str
1 parentfb84c7a commita42fff0

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

‎src/bin/pg_dump/pg_backup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ typedef struct Archive
174174
intverbose;
175175
char*remoteVersionStr;/* server's version string */
176176
intremoteVersion;/* same in numeric form */
177+
intpgproremoteVersion;/* pgpro server's version in numeric form */
177178
boolisStandby;/* is server a standby node */
178179

179180
intminRemoteVersion;/* allowable range */

‎src/bin/pg_dump/pg_backup_db.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,31 @@ static const char *modulename = gettext_noop("archiver (db)");
3333
staticvoid_check_database_version(ArchiveHandle*AH);
3434
staticPGconn*_connectDB(ArchiveHandle*AH,constchar*newdbname,constchar*newUser);
3535
staticvoidnotice_processor(void*arg,constchar*message);
36+
staticvoidget_pgpro_version(ArchiveHandle*AH);
37+
38+
staticvoid
39+
get_pgpro_version(ArchiveHandle*AH)
40+
{
41+
char*query="SELECT pgpro_version()";
42+
PGresult*res;
43+
constchar*pgpro_remoteversion_str;
44+
45+
res=PQexec(AH->connection,query);
46+
/* If the query failed, it means that remote cluster is not PgPro. */
47+
if (PQresultStatus(res)!=PGRES_TUPLES_OK)
48+
{
49+
AH->public.pgproremoteVersion=0;
50+
fprintf(stdout,"pgpro server version: 0; %s version: %s\n",progname,PG_VERSION);
51+
}
52+
else
53+
{
54+
pgpro_remoteversion_str=pg_strdup(PQgetvalue(res,0,0));
55+
AH->public.pgproremoteVersion=1;
56+
fprintf(stdout,"pgpro server version: %s; %s version: %s\n",
57+
pgpro_remoteversion_str,progname,PG_VERSION);
58+
}
59+
PQclear(res);
60+
}
3661

3762
staticvoid
3863
_check_database_version(ArchiveHandle*AH)
@@ -47,6 +72,7 @@ _check_database_version(ArchiveHandle *AH)
4772
exit_horribly(modulename,"could not get server_version from libpq\n");
4873

4974
/* TODO select pgpro_version, pgpro_edition */
75+
get_pgpro_version(AH);
5076

5177
AH->public.remoteVersionStr=pg_strdup(remoteversion_str);
5278
AH->public.remoteVersion=remoteversion;

‎src/bin/pg_dump/pg_dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6281,7 +6281,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
62816281
*/
62826282
resetPQExpBuffer(query);
62836283
/* TODO check pgpro_version instead of just remoteVersion */
6284-
if (fout->remoteVersion >= 90600)
6284+
if (fout->remoteVersion >= 90600 && fout->pgproremoteVersion > 0)
62856285
{
62866286
/*
62876287
* In 9.6 we add INCLUDING columns functionality

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp