Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 10add9d

Browse files
committed
Fix findLastBuiltinOid_V70() to deliver correct result when running
against a 7.0 server. Christopher Kings-Lynne
1 parent d58c70c commit 10add9d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/bin/pg_dump/pg_dump.c

+10-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.353 2003/10/08 03:52:32 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.354 2003/10/21 04:46:28 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -5822,9 +5822,10 @@ setMaxOid(Archive *fout)
58225822
/*
58235823
* findLastBuiltInOid -
58245824
* find the last built in oid
5825-
* we do this by retrieving datlastsysoid from the pg_database entry for this database,
5825+
*
5826+
* For 7.1 and 7.2, we do this by retrieving datlastsysoid from the
5827+
* pg_database entry for the current database
58265828
*/
5827-
58285829
static Oid
58295830
findLastBuiltinOid_V71(const char *dbname)
58305831
{
@@ -5864,10 +5865,11 @@ findLastBuiltinOid_V71(const char *dbname)
58645865
/*
58655866
* findLastBuiltInOid -
58665867
* find the last built in oid
5867-
* we do this by looking up the oid of 'template1' in pg_database,
5868-
* this is probably not foolproof but comes close
5869-
*/
5870-
5868+
*
5869+
* For 7.0, we do this by assuming that the last thing that initdb does is to
5870+
* create the pg_indexes view. This sucks in general, but seeing that 7.0.x
5871+
* initdb won't be changing anymore, it'll do.
5872+
*/
58715873
static Oid
58725874
findLastBuiltinOid_V70(void)
58735875
{
@@ -5876,7 +5878,7 @@ findLastBuiltinOid_V70(void)
58765878
int last_oid;
58775879

58785880
res = PQexec(g_conn,
5879-
"SELECT oid from pg_database where datname = 'template1'");
5881+
"SELECT oid FROM pg_class WHERE relname = 'pg_indexes'");
58805882
if (res == NULL ||
58815883
PQresultStatus(res) != PGRES_TUPLES_OK)
58825884
{

0 commit comments

Comments
 (0)