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

Commit8f0ee46

Browse files
committed
Fix pg_dump so that comments on views are dumped in the proper sequence.
Dump the alignment and storage information for user-defined types (how'dthat manage to slip through the cracks?), and don't dump 'shell' typesthat don't have typisdefined set. Fix badly broken logic for dependenciesof type definitions (did not work for more than one user-defined type...).Avoid memory leakage within pg_dump by being more careful to releasestorage used by PQExpBuffer objects.
1 parent42fbb6d commit8f0ee46

File tree

3 files changed

+180
-71
lines changed

3 files changed

+180
-71
lines changed

‎src/bin/pg_dump/pg_backup_db.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*Implements the basic DB functions used by the archiver.
66
*
77
* IDENTIFICATION
8-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.21 2001/07/0320:21:48 petere Exp $
8+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.22 2001/08/0319:43:05 tgl Exp $
99
*
1010
* NOTES
1111
*
@@ -207,6 +207,8 @@ UserIsSuperuser(ArchiveHandle *AH, char *user)
207207
}
208208
PQclear(res);
209209

210+
destroyPQExpBuffer(qry);
211+
210212
returnisSuper;
211213
}
212214

@@ -678,7 +680,7 @@ ExecuteSqlCommandBuf(ArchiveHandle *AH, void *qryv, int bufLen)
678680
void
679681
FixupBlobRefs(ArchiveHandle*AH,char*tablename)
680682
{
681-
PQExpBuffertblQry=createPQExpBuffer();
683+
PQExpBuffertblQry;
682684
PGresult*res,
683685
*uRes;
684686
inti,
@@ -688,6 +690,8 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename)
688690
if (strcmp(tablename,BLOB_XREF_TABLE)==0)
689691
return;
690692

693+
tblQry=createPQExpBuffer();
694+
691695
appendPQExpBuffer(tblQry,"SELECT a.attname FROM pg_class c, pg_attribute a, pg_type t "
692696
" WHERE a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid "
693697
" AND t.typname = 'oid' AND c.relname = '%s';",tablename);
@@ -699,10 +703,8 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename)
699703

700704
if ((n=PQntuples(res))==0)
701705
{
702-
/*We're done */
706+
/*nothing to do */
703707
ahlog(AH,1,"no OID type columns in table %s\n",tablename);
704-
PQclear(res);
705-
return;
706708
}
707709

708710
for (i=0;i<n;i++)
@@ -741,7 +743,7 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename)
741743
}
742744

743745
PQclear(res);
744-
746+
destroyPQExpBuffer(tblQry);
745747
}
746748

747749
/**********
@@ -766,6 +768,8 @@ CreateBlobXrefTable(ArchiveHandle *AH)
766768

767769
appendPQExpBuffer(qry,"Create Unique Index %s_ix on %s(oldOid)",BLOB_XREF_TABLE,BLOB_XREF_TABLE);
768770
ExecuteSqlCommand(AH,qry,"could not create index on BLOB cross reference table", true);
771+
772+
destroyPQExpBuffer(qry);
769773
}
770774

771775
void
@@ -776,6 +780,8 @@ InsertBlobXref(ArchiveHandle *AH, int old, int new)
776780
appendPQExpBuffer(qry,"Insert Into %s(oldOid, newOid) Values (%d, %d);",BLOB_XREF_TABLE,old,new);
777781

778782
ExecuteSqlCommand(AH,qry,"could not create BLOB cross reference entry", true);
783+
784+
destroyPQExpBuffer(qry);
779785
}
780786

781787
void
@@ -787,6 +793,8 @@ StartTransaction(ArchiveHandle *AH)
787793

788794
ExecuteSqlCommand(AH,qry,"could not start database transaction", false);
789795
AH->txActive= true;
796+
797+
destroyPQExpBuffer(qry);
790798
}
791799

792800
void
@@ -799,6 +807,8 @@ StartTransactionXref(ArchiveHandle *AH)
799807
ExecuteSqlCommand(AH,qry,
800808
"could not start transaction for BLOB cross references", true);
801809
AH->blobTxActive= true;
810+
811+
destroyPQExpBuffer(qry);
802812
}
803813

804814
void
@@ -810,6 +820,8 @@ CommitTransaction(ArchiveHandle *AH)
810820

811821
ExecuteSqlCommand(AH,qry,"could not commit database transaction", false);
812822
AH->txActive= false;
823+
824+
destroyPQExpBuffer(qry);
813825
}
814826

815827
void
@@ -821,4 +833,6 @@ CommitTransactionXref(ArchiveHandle *AH)
821833

822834
ExecuteSqlCommand(AH,qry,"could not commit transaction for BLOB cross references", true);
823835
AH->blobTxActive= false;
836+
837+
destroyPQExpBuffer(qry);
824838
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp