summaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_backup_archiver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_dump/pg_backup_archiver.c')
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c99
1 files changed, 1 insertions, 98 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 52202c7df56..9c8eaaf14e9 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.66 2003/01/27 00:23:38 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.67 2003/02/01 22:06:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -122,102 +122,6 @@ CloseArchive(Archive *AHX)
die_horribly(AH, modulename, "could not close the output file in CloseArchive\n");
}
-/*
- * This function repairs a slip when upgrading PG cast
- * mechanism from 7.2 or earlier to 7.3 or later.
- * The casts between lo and oid are needed when retrieving
- * lo type data in FixupBlobRefs and so adjust lo type in
- * contrib before processing FixupBlobRefs.
- */
-static void
-Adjust_lo_type(ArchiveHandle *AH)
-{
- PGresult *res;
- int nTuples;
-
- /*
- * First check the existence of the cast oid as lo.
- */
- res = PQexec(AH->blobConnection, "select 1 from pg_cast where"
- " castsource in (select oid from pg_type where typname = 'oid')"
- " and casttarget in (select oid from pg_type where typname = 'lo')");
-
- if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
- die_horribly(AH, modulename, "error while checking the cast oid as lo\n");
- nTuples = PQntuples(res);
- PQclear(res);
- if (nTuples == 0)
- {
- /*
- * Check the existence of the cast function lo(oid)
- * and change it to be IMMUTABLE.
- */
- res = PQexec(AH->blobConnection, "update pg_proc set provolatile = 'i'"
- " where proname = 'lo'"
- " and pronargs = 1"
- " and prorettype in (select oid from pg_type where typname = 'lo')"
- " and proargtypes[0] in (select oid from pg_type where typname = 'oid')");
-
- if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
- die_horribly(AH, modulename, "could not adjust lo(oid) function\n");
- nTuples = atoi(PQcmdTuples(res));
- PQclear(res);
- if (nTuples == 1)
- {
- /*
- * The cast function lo(oid) exists and
- * then create the correspoding cast.
- */
- res = PQexec(AH->blobConnection, "create cast"
- " (oid as lo) with function lo(oid) as implicit");
- if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
- die_horribly(AH, modulename, "couldn't create cast (oid as lo)\n");
- PQclear(res);
- }
- }
-
- /*
- * Also check the existence of the cast lo as oid.
- */
- res = PQexec(AH->blobConnection, "select 1 from pg_cast where"
- " castsource in (select oid from pg_type where typname = 'lo')"
- " and casttarget in (select oid from pg_type where typname = 'oid')");
-
- if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
- die_horribly(AH, modulename, "error while checking the cast lo as oid\n");
- nTuples = PQntuples(res);
- PQclear(res);
- if (nTuples == 0)
- {
- /*
- * Check the existence of the cast function oid(lo)
- * and change it to be IMMUTABLE.
- */
- res = PQexec(AH->blobConnection, "update pg_proc set provolatile = 'i'"
- " where proname = 'oid'"
- " and pronargs = 1"
- " and prorettype in (select oid from pg_type where typname = 'oid')"
- " and proargtypes[0] in (select oid from pg_type where typname = 'lo')");
-
- if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
- die_horribly(AH, modulename, "could not adjust oid(lo) function\n");
- nTuples = atoi(PQcmdTuples(res));
- PQclear(res);
- if (nTuples == 1)
- {
- /*
- * The cast function oid(lo) exists and
- * then create the correspoding cast.
- */
- res = PQexec(AH->blobConnection, "create cast"
- " (lo as oid) with function oid(lo) as implicit");
- if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
- die_horribly(AH, modulename, "couldn't create cast (lo as oid)\n");
- PQclear(res);
- }
- }
-}
-
/* Public */
void
RestoreArchive(Archive *AHX, RestoreOptions *ropt)
@@ -453,7 +357,6 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
/* NULL parameter means disable ALL user triggers */
_disableTriggersIfNecessary(AH, NULL, ropt);
- Adjust_lo_type(AH);
te = AH->toc->next;
while (te != AH->toc)
{