/*------------------------------------------------------------------------- * * common.c-- * common routines between pg_dump and pg4_dump * * Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.12 1997/06/02 02:51:49 scrappy Exp $ * * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * * - Fixed dumpTable output to output lengths for char and varchar types! * - Added single. quote to twin single quote expansion for 'insert' string * mode. * *------------------------------------------------------------------------- */ #include #include #include #include /* for MAXHOSTNAMELEN on most */ #ifdef sparc_solaris #include /* for MAXHOSTNAMELEN on some */ #endif #include "postgres.h" #include "libpq-fe.h" #ifndef HAVE_STRDUP #include "strdup.h" #endif #include "pg_dump.h" /* * findTypeByOid * given an oid of a type, return its typename * * if oid is "0", return "opaque" -- this is a special case * * NOTE: should hash this, but just do linear search for now */ char* findTypeByOid(TypeInfo* tinfo, int numTypes, const char* oid) { int i; if (strcmp(oid, "0") == 0) return g_opaque_type; for (i=0;i 0) { result = (char**)malloc(sizeof(char*) * numParents); j = 0; for (i=0;i= 0; i--) { tblinfo[i].parentRels = findParentsByOid(tblinfo, numTables, inhinfo, numInherits, tblinfo[i].oid, &tblinfo[i].numParents); for (k=0;k 1 && relname[1] == ','); }