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

Commitee3c51d

Browse files
committed
Fix a number of places where pg_dump was careless about explicitly
coercing OID literals to OID in its queries. Depending on the queryand the server version, this could cause failures for OIDs over 2 billion.
1 parentb579d46 commitee3c51d

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 8 additions & 16 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.228 2001/09/06 02:07:42 tgl Exp $
25+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.229 2001/09/07 01:11:50 tgl Exp $
2626
*
2727
*-------------------------------------------------------------------------
2828
*/
@@ -726,7 +726,7 @@ main(int argc, char **argv)
726726
else
727727
progname=strrchr(argv[0],'/')+1;
728728

729-
/* Setdefaulty options based on progname */
729+
/* Setdefault options based on progname */
730730
if (strcmp(progname,"pg_backup")==0)
731731
{
732732
format="c";
@@ -1449,8 +1449,6 @@ getTypes(int *numTypes)
14491449
* OprInfo* structure
14501450
*
14511451
*numOprs is set to the number of operators read in
1452-
*
1453-
*
14541452
*/
14551453
OprInfo*
14561454
getOperators(int*numOprs)
@@ -1821,8 +1819,6 @@ clearAggInfo(AggInfo *agginfo, int numArgs)
18211819
* return them in the AggInfo* structure
18221820
*
18231821
* numAggs is set to the number of aggregates read in
1824-
*
1825-
*
18261822
*/
18271823
AggInfo*
18281824
getAggregates(int*numAggs)
@@ -2040,8 +2036,6 @@ getFuncs(int *numFuncs)
20402036
* in the system catalogs return them in the TableInfo* structure
20412037
*
20422038
* numTables is set to the number of tables read in
2043-
*
2044-
*
20452039
*/
20462040
TableInfo*
20472041
getTables(int*numTables,FuncInfo*finfo,intnumFuncs)
@@ -2297,7 +2291,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
22972291

22982292
resetPQExpBuffer(query);
22992293
appendPQExpBuffer(query,
2300-
"SELECT indexrelid FROM pg_index i WHERE i.indisprimary AND i.indrelid =%s ",
2294+
"SELECT indexrelid FROM pg_index i WHERE i.indisprimary AND i.indrelid ='%s'::oid ",
23012295
tblinfo[i].oid);
23022296
res2=PQexec(g_conn,query->data);
23032297
if (!res2||PQresultStatus(res2)!=PGRES_TUPLES_OK)
@@ -2335,7 +2329,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
23352329
resetPQExpBuffer(query);
23362330
appendPQExpBuffer(query,
23372331
"SELECT relname FROM pg_class "
2338-
"WHERE oid =%s",
2332+
"WHERE oid ='%s'::oid",
23392333
tblinfo[i].pkIndexOid);
23402334

23412335
res2=PQexec(g_conn,query->data);
@@ -2656,8 +2650,6 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
26562650
* from the system catalogs return them in the InhInfo* structure
26572651
*
26582652
* numInherits is set to the number of tables read in
2659-
*
2660-
*
26612653
*/
26622654
InhInfo*
26632655
getInherits(int*numInherits)
@@ -3013,15 +3005,15 @@ dumpComment(Archive *fout, const char *target, const char *oid,
30133005
if (fout->remoteVersion >=70200)
30143006
{
30153007
appendPQExpBuffer(query,"SELECT description FROM pg_description "
3016-
"WHERE objoid =%s and classoid = "
3008+
"WHERE objoid ='%s'::oid and classoid = "
30173009
"(SELECT oid FROM pg_class where relname = '%s') "
30183010
"and objsubid = %d",
30193011
oid,classname,subid);
30203012
}
30213013
else
30223014
{
30233015
/* Note: this will fail to find attribute comments in pre-7.2... */
3024-
appendPQExpBuffer(query,"SELECT description FROM pg_description WHERE objoid =%s",oid);
3016+
appendPQExpBuffer(query,"SELECT description FROM pg_description WHERE objoid ='%s'::oid",oid);
30253017
}
30263018

30273019
/*** Execute query ***/
@@ -3396,7 +3388,7 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
33963388

33973389
/* becomeUser(fout, finfo[i].usename); */
33983390

3399-
sprintf(query,"SELECT lanname FROM pg_language WHERE oid =%u",
3391+
sprintf(query,"SELECT lanname FROM pg_language WHERE oid ='%u'::oid",
34003392
finfo[i].lang);
34013393
res=PQexec(g_conn,query);
34023394
if (!res||
@@ -4556,7 +4548,7 @@ dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes,
45564548
intnumRows;
45574549
PQExpBufferpred=createPQExpBuffer();
45584550

4559-
appendPQExpBuffer(pred,"SELECT pg_get_expr(indpred,indrelid) as pred FROM pg_index WHERE indexrelid =%s",
4551+
appendPQExpBuffer(pred,"SELECT pg_get_expr(indpred,indrelid) as pred FROM pg_index WHERE indexrelid ='%s'::oid",
45604552
indinfo[i].indexreloid);
45614553
res=PQexec(g_conn,pred->data);
45624554
if (!res||PQresultStatus(res)!=PGRES_TUPLES_OK)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp