Commit 135040d5 authored by Philip Warner's avatar Philip Warner

Patch to put rudimentary dependency support into pg_dump. This addresses

the UDT/function order problem.

    - Rudimentary support for dependencies in archives.
      Uses dependencies to modify the OID used in sorting TOC
      entries. This will NOT handle multi-level dependencies,
      but will manage simple relationships like UDTs & their functions.

    - Treat OIDs with more respect (avoid using ints, use macros
      for conversion & comparison).
parent 55f0f5d9
......@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.9 2001/03/22 04:00:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.10 2001/04/01 05:42:50 pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
......@@ -47,6 +47,10 @@
#include "libpq-fe.h"
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
#define oidcmp(x,y) ( ((x) < (y) ? -1 : ((x) > (y)) ? 1 : 0) )
#define oideq(x,y) ( (x) == (y) )
typedef enum _archiveFormat
{
archUnknown = 0,
......@@ -131,7 +135,7 @@ PGconn *ConnectDatabase(Archive *AH,
/* Called to add a TOC entry */
extern void ArchiveEntry(Archive *AH, const char *oid, const char *name,
const char *desc, const char *(deps[]), const char *defn,
const char *desc, const char *((*deps)[]), const char *defn,
const char *dropStmt, const char *copyStmt, const char *owner,
DataDumperPtr dumpFn, void *dumpArg);
......@@ -142,8 +146,8 @@ extern int WriteData(Archive *AH, const void *data, int dLen);
extern int StartBlobs(Archive* AH);
extern int EndBlobs(Archive* AH);
*/
extern int StartBlob(Archive *AH, int oid);
extern int EndBlob(Archive *AH, int oid);
extern int StartBlob(Archive *AH, Oid oid);
extern int EndBlob(Archive *AH, Oid oid);
extern void CloseArchive(Archive *AH);
......
......@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.22 2001/03/22 04:00:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.23 2001/04/01 05:42:50 pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
......@@ -41,6 +41,16 @@
* Modifications - 6-Mar-2001 - pjw@rhyme.com.au
* - Only disable triggers in DataOnly (or implied data-only) restores.
*
* Modifications - 31-Mar-2001 - pjw@rhyme.com.au
*
* - Rudimentary support for dependencies in archives. Current implementation
* uses dependencies to modify the OID used in sorting TOC entries.
* This will NOT handle multi-level dependencies, but will manage simple
* relationships like UDTs & their functions.
*
* - Treat OIDs with more respect (avoid using ints, use macros for
* conversion & comparison).
*
*-------------------------------------------------------------------------
*/
......@@ -75,6 +85,8 @@ static TocEntry *_getTocEntry(ArchiveHandle *AH, int id);
static void _moveAfter(ArchiveHandle *AH, TocEntry *pos, TocEntry *te);
static void _moveBefore(ArchiveHandle *AH, TocEntry *pos, TocEntry *te);
static int _discoverArchiveFormat(ArchiveHandle *AH);
static void _fixupOidInfo(TocEntry *te);
static Oid _findMaxOID(const char *((*deps)[]));
static char *progname = "Archiver";
......@@ -557,7 +569,7 @@ WriteData(Archive *AHX, const void *data, int dLen)
/* Public */
void
ArchiveEntry(Archive *AHX, const char *oid, const char *name,
const char *desc, const char *(deps[]), const char *defn,
const char *desc, const char *((*deps)[]), const char *defn,
const char *dropStmt, const char *copyStmt, const char *owner,
DataDumperPtr dumpFn, void *dumpArg)
{
......@@ -577,10 +589,15 @@ ArchiveEntry(Archive *AHX, const char *oid, const char *name,
AH->toc->prev = newToc;
newToc->id = AH->lastID;
newToc->oid = strdup(oid);
newToc->oidVal = atoi(oid);
newToc->name = strdup(name);
newToc->desc = strdup(desc);
newToc->oid = strdup(oid);
newToc->depOid = deps;
_fixupOidInfo(newToc);
newToc->defn = strdup(defn);
newToc->dropStmt = strdup(dropStmt);
newToc->copyStmt = copyStmt ? strdup(copyStmt) : NULL;
......@@ -654,7 +671,7 @@ PrintTOCSummary(Archive *AHX, RestoreOptions *ropt)
/* Called by a dumper to signal start of a BLOB */
int
StartBlob(Archive *AHX, int oid)
StartBlob(Archive *AHX, Oid oid)
{
ArchiveHandle *AH = (ArchiveHandle *) AHX;
......@@ -668,7 +685,7 @@ StartBlob(Archive *AHX, int oid)
/* Called by a dumper to signal end of a BLOB */
int
EndBlob(Archive *AHX, int oid)
EndBlob(Archive *AHX, Oid oid)
{
ArchiveHandle *AH = (ArchiveHandle *) AHX;
......@@ -714,7 +731,7 @@ EndRestoreBlobs(ArchiveHandle *AH)
* Called by a format handler to initiate restoration of a blob
*/
void
StartRestoreBlob(ArchiveHandle *AH, int oid)
StartRestoreBlob(ArchiveHandle *AH, Oid oid)
{
int loOid;
......@@ -756,7 +773,7 @@ StartRestoreBlob(ArchiveHandle *AH, int oid)
}
void
EndRestoreBlob(ArchiveHandle *AH, int oid)
EndRestoreBlob(ArchiveHandle *AH, Oid oid)
{
lo_close(AH->connection, AH->loFd);
AH->writingBlob = 0;
......@@ -1331,7 +1348,7 @@ ReadInt(ArchiveHandle *AH)
}
int
WriteStr(ArchiveHandle *AH, char *c)
WriteStr(ArchiveHandle *AH, const char *c)
{
int res;
......@@ -1630,6 +1647,8 @@ void
WriteToc(ArchiveHandle *AH)
{
TocEntry *te = AH->toc->next;
const char *dep;
int i;
/* printf("%d TOC Entries to save\n", AH->tocCount); */
......@@ -1639,12 +1658,25 @@ WriteToc(ArchiveHandle *AH)
WriteInt(AH, te->id);
WriteInt(AH, te->dataDumper ? 1 : 0);
WriteStr(AH, te->oid);
WriteStr(AH, te->name);
WriteStr(AH, te->desc);
WriteStr(AH, te->defn);
WriteStr(AH, te->dropStmt);
WriteStr(AH, te->copyStmt);
WriteStr(AH, te->owner);
/* Dump list of dependencies */
if (te->depOid != NULL)
{
i = 0;
while( (dep = (*te->depOid)[i++]) != NULL)
{
WriteStr(AH, dep);
}
}
WriteStr(AH, NULL); /* Terminate List */
if (AH->WriteExtraTocPtr)
(*AH->WriteExtraTocPtr) (AH, te);
te = te->next;
......@@ -1655,6 +1687,9 @@ void
ReadToc(ArchiveHandle *AH)
{
int i;
char *((*deps)[]);
int depIdx;
int depSize;
TocEntry *te = AH->toc->next;
......@@ -1672,7 +1707,8 @@ ReadToc(ArchiveHandle *AH)
te->hadDumper = ReadInt(AH);
te->oid = ReadStr(AH);
te->oidVal = atoi(te->oid);
te->oidVal = atooid(te->oid);
te->name = ReadStr(AH);
te->desc = ReadStr(AH);
te->defn = ReadStr(AH);
......@@ -1683,6 +1719,40 @@ ReadToc(ArchiveHandle *AH)
te->owner = ReadStr(AH);
/* Read TOC entry dependencies */
if (AH->version >= K_VERS_1_5)
{
depSize = 100;
deps = malloc(sizeof(char*) * depSize);
depIdx = 0;
do
{
if (depIdx > depSize)
{
depSize *= 2;
deps = realloc(deps, sizeof(char*) * depSize);
}
(*deps)[depIdx] = ReadStr(AH);
/*
* if ((*deps)[depIdx])
* fprintf(stderr, "Read Dependency for %s -> %s\n", te->name, (*deps)[depIdx]);
*/
} while ( (*deps)[depIdx++] != NULL);
if (depIdx > 1) /* We have a non-null entry */
{
/* Trim it */
te->depOid = realloc(deps, sizeof(char*) * depIdx);
} else { /* No deps */
te->depOid = NULL;
}
} else {
te->depOid = NULL;
}
/* Set maxOidVal etc for use in sorting */
_fixupOidInfo(te);
if (AH->ReadExtraTocPtr)
(*AH->ReadExtraTocPtr) (AH, te);
......@@ -1984,17 +2054,50 @@ _tocSortCompareByOIDNum(const void *p1, const void *p2)
{
TocEntry *te1 = *(TocEntry **) p1;
TocEntry *te2 = *(TocEntry **) p2;
int id1 = te1->oidVal;
int id2 = te2->oidVal;
Oid id1 = te1->maxOidVal;
Oid id2 = te2->maxOidVal;
int cmpval;
/* printf("Comparing %d to %d\n", id1, id2); */
if (id1 < id2)
return -1;
else if (id1 > id2)
return 1;
else
return _tocSortCompareByIDNum(te1, te2);
cmpval = oidcmp(id1, id2);
/* If we have a deterministic answer, return it. */
if (cmpval != 0)
return cmpval;
/* More comparisons required */
if ( oideq(id1, te1->maxDepOidVal) ) /* maxOid1 came from deps */
{
if ( oideq(id2, te2->maxDepOidVal) ) /* maxOid2 also came from deps */
{
cmpval = oidcmp(te1->oidVal, te2->oidVal); /* Just compare base OIDs */
}
else /* MaxOid2 was entry OID */
{
return 1; /* entry1 > entry2 */
};
}
else /* must have oideq(id1, te1->oidVal) => maxOid1 = Oid1 */
{
if ( oideq(id2, te2->maxDepOidVal) ) /* maxOid2 came from deps */
{
return -1; /* entry1 < entry2 */
}
else /* MaxOid2 was entry OID - deps don't matter */
{
cmpval = 0;
};
};
/* If we get here, then we've done another comparison
* Once again, a 0 result means we require even more
*/
if (cmpval != 0)
return cmpval;
/* Entire OID details match, so use ID number (ie. original pg_dump order) */
return _tocSortCompareByIDNum(te1, te2);
}
static int
......@@ -2015,6 +2118,48 @@ _tocSortCompareByIDNum(const void *p1, const void *p2)
return 0;
}
/*
* Assuming Oid and depOid are set, work out the various
* Oid values used in sorting.
*/
static void
_fixupOidInfo(TocEntry *te)
{
te->oidVal = atooid(te->oid);
te->maxDepOidVal = _findMaxOID(te->depOid);
/* For the purpose of sorting, find the max OID. */
if (oidcmp(te->oidVal, te->maxDepOidVal) >= 0)
te->maxOidVal = te->oidVal;
else
te->maxOidVal = te->maxDepOidVal;
}
/*
* Find the max OID value for a given list of string Oid values
*/
static Oid
_findMaxOID(const char *((*deps)[]))
{
const char *dep;
int i;
Oid maxOid = (Oid)0;
Oid currOid;
if (!deps)
return maxOid;
i = 0;
while( (dep = (*deps)[i++]) != NULL)
{
currOid = atooid(dep);
if (oidcmp(maxOid, currOid) < 0)
maxOid = currOid;
}
return maxOid;
}
/*
* Maybe I can use this somewhere...
*
......
......@@ -17,15 +17,18 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.27 2001/03/22 04:00:12 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.28 2001/04/01 05:42:51 pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
* Initial version.
* - Initial version.
*
* Modifications - 15-Sep-2000 - pjw@rhyme.com.au
* - Added braceDepth to sqlparseInfo to handle braces in rule definitions.
*
* Modifications - 31-Mar-2001 - pjw@rhyme.com.au (1.50)
* - Make dependencies work on ArchiveEntry calls so that UDTs will
* dump in correct order.
*
*-------------------------------------------------------------------------
*/
......@@ -64,8 +67,8 @@ typedef z_stream *z_streamp;
#include "libpq-fe.h"
#define K_VERS_MAJOR 1
#define K_VERS_MINOR 4
#define K_VERS_REV 30
#define K_VERS_MINOR 5
#define K_VERS_REV 0
/* Data block types */
#define BLK_DATA 1
......@@ -77,7 +80,8 @@ typedef z_stream *z_streamp;
#define K_VERS_1_2 (( (1 * 256 + 2) * 256 + 0) * 256 + 0) /* Allow No ZLIB */
#define K_VERS_1_3 (( (1 * 256 + 3) * 256 + 0) * 256 + 0) /* BLOBs */
#define K_VERS_1_4 (( (1 * 256 + 4) * 256 + 0) * 256 + 0) /* Date & name in header */
#define K_VERS_MAX (( (1 * 256 + 4) * 256 + 255) * 256 + 0)
#define K_VERS_1_5 (( (1 * 256 + 5) * 256 + 0) * 256 + 0) /* Handle dependencies */
#define K_VERS_MAX (( (1 * 256 + 5) * 256 + 255) * 256 + 0)
/* No of BLOBs to restore in 1 TX */
#define BLOB_BATCH_SIZE 100
......@@ -94,8 +98,8 @@ typedef int (*WriteDataPtr) (struct _archiveHandle * AH, const void *data, int d
typedef void (*EndDataPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
typedef void (*StartBlobsPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
typedef void (*StartBlobPtr) (struct _archiveHandle * AH, struct _tocEntry * te, int oid);
typedef void (*EndBlobPtr) (struct _archiveHandle * AH, struct _tocEntry * te, int oid);
typedef void (*StartBlobPtr) (struct _archiveHandle * AH, struct _tocEntry * te, Oid oid);
typedef void (*EndBlobPtr) (struct _archiveHandle * AH, struct _tocEntry * te, Oid oid);
typedef void (*EndBlobsPtr) (struct _archiveHandle * AH, struct _tocEntry * te);
typedef int (*WriteBytePtr) (struct _archiveHandle * AH, const int i);
......@@ -184,8 +188,8 @@ typedef struct _archiveHandle
ReadBufPtr ReadBufPtr; /* Read a buffer of input from the archive */
ClosePtr ClosePtr; /* Close the archive */
WriteExtraTocPtr WriteExtraTocPtr; /* Write extra TOC entry data
* associated with */
/* the current archive format */
* associated with
* the current archive format */
ReadExtraTocPtr ReadExtraTocPtr; /* Read extr info associated with
* archie format */
PrintExtraTocPtr PrintExtraTocPtr; /* Extra TOC info for format */
......@@ -244,15 +248,18 @@ typedef struct _tocEntry
int id;
int hadDumper; /* Archiver was passed a dumper routine
* (used in restore) */
char *oid;
int oidVal;
char *name;
char *desc;
char *defn;
char *dropStmt;
char *copyStmt;
char *owner;
char **depOid;
char *oid; /* Oid of source of entry */
Oid oidVal; /* Value of above */
const char *((*depOid)[]);
Oid maxDepOidVal; /* Value of largest OID in deps */
Oid maxOidVal; /* Max of entry OID and max dep OID */
int printed; /* Indicates if entry defn has been dumped */
DataDumperPtr dataDumper; /* Routine to dump data for object */
void *dataDumperArg; /* Arg for above routine */
......@@ -282,11 +289,11 @@ extern int TocIDRequired(ArchiveHandle *AH, int id, RestoreOptions *ropt);
extern int WriteInt(ArchiveHandle *AH, int i);
extern int ReadInt(ArchiveHandle *AH);
extern char *ReadStr(ArchiveHandle *AH);
extern int WriteStr(ArchiveHandle *AH, char *s);
extern int WriteStr(ArchiveHandle *AH, const char *s);
extern void StartRestoreBlobs(ArchiveHandle *AH);
extern void StartRestoreBlob(ArchiveHandle *AH, int oid);
extern void EndRestoreBlob(ArchiveHandle *AH, int oid);
extern void StartRestoreBlob(ArchiveHandle *AH, Oid oid);
extern void EndRestoreBlob(ArchiveHandle *AH, Oid oid);
extern void EndRestoreBlobs(ArchiveHandle *AH);
extern void InitArchiveFmt_Custom(ArchiveHandle *AH);
......
......@@ -19,7 +19,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.9 2001/03/22 04:00:12 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.10 2001/04/01 05:42:51 pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
......@@ -62,8 +62,8 @@ static void _skipData(ArchiveHandle *AH);
static void _skipBlobs(ArchiveHandle *AH);
static void _StartBlobs(ArchiveHandle *AH, TocEntry *te);
static void _StartBlob(ArchiveHandle *AH, TocEntry *te, int oid);
static void _EndBlob(ArchiveHandle *AH, TocEntry *te, int oid);
static void _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid);
static void _EndBlob(ArchiveHandle *AH, TocEntry *te, Oid oid);
static void _EndBlobs(ArchiveHandle *AH, TocEntry *te);
static void _LoadBlobs(ArchiveHandle *AH);
......@@ -384,7 +384,7 @@ _StartBlobs(ArchiveHandle *AH, TocEntry *te)
* Must save the passed OID for retrieval at restore-time.
*/
static void
_StartBlob(ArchiveHandle *AH, TocEntry *te, int oid)
_StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid)
{
if (oid == 0)
die_horribly(AH, "%s: illegal OID for BLOB (%d)\n", progname, oid);
......@@ -400,7 +400,7 @@ _StartBlob(ArchiveHandle *AH, TocEntry *te, int oid)
*
*/
static void
_EndBlob(ArchiveHandle *AH, TocEntry *te, int oid)
_EndBlob(ArchiveHandle *AH, TocEntry *te, Oid oid)
{
_EndDataCompressor(AH, te);
}
......
......@@ -20,7 +20,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.9 2001/03/23 01:27:12 pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.10 2001/04/01 05:42:51 pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
......@@ -54,8 +54,8 @@ static void _ReadExtraToc(ArchiveHandle *AH, TocEntry *te);
static void _PrintExtraToc(ArchiveHandle *AH, TocEntry *te);
static void _StartBlobs(ArchiveHandle *AH, TocEntry *te);
static void _StartBlob(ArchiveHandle *AH, TocEntry *te, int oid);
static void _EndBlob(ArchiveHandle *AH, TocEntry *te, int oid);
static void _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid);
static void _EndBlob(ArchiveHandle *AH, TocEntry *te, Oid oid);
static void _EndBlobs(ArchiveHandle *AH, TocEntry *te);
#define K_STD_BUF_SIZE 1024
......@@ -490,7 +490,7 @@ _StartBlobs(ArchiveHandle *AH, TocEntry *te)
* Must save the passed OID for retrieval at restore-time.
*/
static void
_StartBlob(ArchiveHandle *AH, TocEntry *te, int oid)
_StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid)
{
lclContext *ctx = (lclContext *) AH->formatData;
lclTocEntry *tctx = (lclTocEntry *) te->formatData;
......@@ -528,7 +528,7 @@ _StartBlob(ArchiveHandle *AH, TocEntry *te, int oid)
*
*/
static void
_EndBlob(ArchiveHandle *AH, TocEntry *te, int oid)
_EndBlob(ArchiveHandle *AH, TocEntry *te, Oid oid)
{
lclTocEntry *tctx = (lclTocEntry *) te->formatData;
......
......@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.12 2001/03/22 04:00:13 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.13 2001/04/01 05:42:51 pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
......@@ -53,8 +53,8 @@ static void _ReadExtraToc(ArchiveHandle *AH, TocEntry *te);
static void _PrintExtraToc(ArchiveHandle *AH, TocEntry *te);
static void _StartBlobs(ArchiveHandle *AH, TocEntry *te);
static void _StartBlob(ArchiveHandle *AH, TocEntry *te, int oid);
static void _EndBlob(ArchiveHandle *AH, TocEntry *te, int oid);
static void _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid);
static void _EndBlob(ArchiveHandle *AH, TocEntry *te, Oid oid);
static void _EndBlobs(ArchiveHandle *AH, TocEntry *te);
#define K_STD_BUF_SIZE 1024
......@@ -896,7 +896,7 @@ _StartBlobs(ArchiveHandle *AH, TocEntry *te)
* Must save the passed OID for retrieval at restore-time.
*/
static void
_StartBlob(ArchiveHandle *AH, TocEntry *te, int oid)
_StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid)
{
lclContext *ctx = (lclContext *) AH->formatData;
lclTocEntry *tctx = (lclTocEntry *) te->formatData;
......@@ -926,7 +926,7 @@ _StartBlob(ArchiveHandle *AH, TocEntry *te, int oid)
*
*/
static void
_EndBlob(ArchiveHandle *AH, TocEntry *te, int oid)
_EndBlob(ArchiveHandle *AH, TocEntry *te, Oid oid)
{
lclTocEntry *tctx = (lclTocEntry *) te->formatData;
......
......@@ -22,7 +22,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.197 2001/03/23 04:49:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.198 2001/04/01 05:42:51 pjw Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
......@@ -115,6 +115,13 @@
* quoting problems in trigger enable/disable code for mixed case
* table names, and avoids commands like 'pg_restore -t '"TblA"''
*
* Modifications - 31-Mar-2001 - pjw@rhyme.com.au
*
* - Dump dependency information in dumpType. This is necessary
* because placeholder types will have an OID less than the
* OID of the type functions, but type must be created after
* the functions.
*
*-------------------------------------------------------------------------
*/
......@@ -152,9 +159,6 @@
#include "pg_dump.h"
#include "pg_backup.h"
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
typedef enum _formatLiteralOptions
{
CONV_ALL = 0,
......@@ -2939,6 +2943,10 @@ dumpTypes(Archive *fout, FuncInfo *finfo, int numFuncs,
PQExpBuffer q = createPQExpBuffer();
PQExpBuffer delq = createPQExpBuffer();
int funcInd;
const char *((*deps)[]);
int depIdx = 0;
deps = malloc(sizeof(char*) * 10);
for (i = 0; i < numTypes; i++)
{
......@@ -2962,11 +2970,17 @@ dumpTypes(Archive *fout, FuncInfo *finfo, int numFuncs,
*/
funcInd = findFuncByName(finfo, numFuncs, tinfo[i].typinput);
if (funcInd != -1)
{
(*deps)[depIdx++] = strdup(finfo[funcInd].oid);
dumpOneFunc(fout, finfo, funcInd, tinfo, numTypes);
}
funcInd = findFuncByName(finfo, numFuncs, tinfo[i].typoutput);
if (funcInd != -1)
{
(*deps)[depIdx++] = strdup(finfo[funcInd].oid);
dumpOneFunc(fout, finfo, funcInd, tinfo, numTypes);
}
appendPQExpBuffer(delq, "DROP TYPE %s;\n", fmtId(tinfo[i].typname, force_quotes));
......@@ -3004,13 +3018,17 @@ dumpTypes(Archive *fout, FuncInfo *finfo, int numFuncs,
appendPQExpBuffer(q, ", element = %s, delimiter = ", elemType);
formatStringLiteral(q, tinfo[i].typdelim, CONV_ALL);
(*deps)[depIdx++] = strdup(tinfo[i].typelem);
}
if (tinfo[i].passedbyvalue)
appendPQExpBuffer(q, ",passedbyvalue);\n");
else
appendPQExpBuffer(q, ");\n");
ArchiveEntry(fout, tinfo[i].oid, tinfo[i].typname, "TYPE", NULL,
(*deps)[depIdx++] = NULL; /* End of List */
ArchiveEntry(fout, tinfo[i].oid, tinfo[i].typname, "TYPE", deps,
q->data, delq->data, "", tinfo[i].usename, NULL, NULL);
/*** Dump Type Comments ***/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment