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

Commit3cf6e94

Browse files
committed
Use new datlastsysoid field in pg_database + some cleanups & fixes
1 parent4ac1742 commit3cf6e94

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
220220
*/
221221
if (!AH->CustomOutPtr)
222222
fprintf(stderr,"%s: WARNING - skipping BLOB restoration\n",progname);
223+
223224
}else {
224225

225226
_disableTriggers(AH,te,ropt);
@@ -951,6 +952,10 @@ int ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle* AH)
951952
{
952953
res=lo_write(AH->connection,AH->loFd, (void*)ptr,size*nmemb);
953954
ahlog(AH,5,"Wrote %d bytes of BLOB data (result = %d)\n",size*nmemb,res);
955+
if (res<size*nmemb)
956+
die_horribly(AH,"%s: could not write to large object (result = %d, expected %d)\n",
957+
progname,res,size*nmemb);
958+
954959
returnres;
955960
}
956961
elseif (AH->gzOut)

‎src/bin/pg_dump/pg_backup_archiver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ typedef z_stream *z_streamp;
6262

6363
#defineK_VERS_MAJOR 1
6464
#defineK_VERS_MINOR 4
65-
#defineK_VERS_REV17
65+
#defineK_VERS_REV19
6666

6767
/* Data block types */
6868
#defineBLK_DATA 1

‎src/bin/pg_dump/pg_dump.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
*
2424
* IDENTIFICATION
25-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.172 2000/10/2205:27:18 momjian Exp $
25+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.173 2000/10/2218:13:09 pjw Exp $
2626
*
2727
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2828
*
@@ -140,7 +140,7 @@ static char *checkForQuote(const char *s);
140140
staticvoidclearTableInfo(TableInfo*,int);
141141
staticvoiddumpOneFunc(Archive*fout,FuncInfo*finfo,inti,
142142
TypeInfo*tinfo,intnumTypes);
143-
staticintfindLastBuiltinOid(void);
143+
staticintfindLastBuiltinOid(constchar*);
144144
staticvoidsetMaxOid(Archive*fout);
145145

146146
staticvoidAddAcl(char*aclbuf,constchar*keyword);
@@ -954,7 +954,7 @@ main(int argc, char **argv)
954954
PQclear(res);
955955
}
956956

957-
g_last_builtin_oid=findLastBuiltinOid();
957+
g_last_builtin_oid=findLastBuiltinOid(dbname);
958958

959959
/* Dump the database definition */
960960
if (!dataOnly)
@@ -3888,14 +3888,17 @@ setMaxOid(Archive *fout)
38883888
*/
38893889

38903890
staticint
3891-
findLastBuiltinOid(void)
3891+
findLastBuiltinOid(constchar*dbname)
38923892
{
38933893
PGresult*res;
38943894
intntups;
38953895
intlast_oid;
3896+
PQExpBufferquery=createPQExpBuffer();
3897+
3898+
resetPQExpBuffer(query);
3899+
appendPQExpBuffer(query,"SELECT datlastsysoid from pg_database where datname = '%s'",dbname);
38963900

3897-
res=PQexec(g_conn,
3898-
"SELECT oid from pg_database where datname = 'template1'");
3901+
res=PQexec(g_conn,query->data);
38993902
if (res==NULL||
39003903
PQresultStatus(res)!=PGRES_TUPLES_OK)
39013904
{
@@ -3916,7 +3919,7 @@ findLastBuiltinOid(void)
39163919
fprintf(stderr,"There is more than one 'template1' entry in the 'pg_database' table\n");
39173920
exit_nicely(g_conn);
39183921
}
3919-
last_oid=atoi(PQgetvalue(res,0,PQfnumber(res,"oid")));
3922+
last_oid=atoi(PQgetvalue(res,0,PQfnumber(res,"datlastsysoid")));
39203923
PQclear(res);
39213924
returnlast_oid;
39223925
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp