/* subquery used to convert user ID (eg, datdba) to user name */
static const char *username_subquery;
-/* obsolete as of 7.3: */
-static Oid g_last_builtin_oid; /* value of the last builtin oid */
-
/* The specified names/patterns should to match at least one entity */
static int strict_names = 0;
SimpleStringList *patterns,
SimpleOidList *oids,
bool strict_names);
-static NamespaceInfo *findNamespace(Archive *fout, Oid nsoid, Oid objoid);
+static NamespaceInfo *findNamespace(Archive *fout, Oid nsoid);
static void dumpTableData(Archive *fout, TableDataInfo *tdinfo);
static void refreshMatViewData(Archive *fout, TableDataInfo *tdinfo);
static void guessConstraintInheritance(TableInfo *tblinfo, int numTables);
const char *proc);
static char *convertOperatorReference(Archive *fout, const char *opr);
static char *convertTSFunction(Archive *fout, Oid funcOid);
-static Oid findLastBuiltinOid_V71(Archive *fout, const char *);
-static Oid findLastBuiltinOid_V70(Archive *fout);
static void selectSourceSchema(Archive *fout, const char *schemaName);
static char *getFormattedTypeName(Archive *fout, Oid oid, OidOptions opts);
-static char *myFormatType(const char *typname, int32 typmod);
static void getBlobs(Archive *fout);
static void dumpBlob(Archive *fout, BlobInfo *binfo);
static int dumpBlobs(Archive *fout, void *arg);
fout->verbose = g_verbose;
/*
- * We allow the server to be back to 7.0, and up to any minor release of
+ * We allow the server to be back to 8.0, and up to any minor release of
* our own major version. (See also version check in pg_dumpall.c.)
*/
- fout->minRemoteVersion = 70000;
+ fout->minRemoteVersion = 80000;
fout->maxRemoteVersion = (PG_VERSION_NUM / 100) * 100 + 99;
fout->numWorkers = numWorkers;
/* Select the appropriate subquery to convert user IDs to names */
if (fout->remoteVersion >= 80100)
username_subquery = "SELECT rolname FROM pg_catalog.pg_roles WHERE oid =";
- else if (fout->remoteVersion >= 70300)
- username_subquery = "SELECT usename FROM pg_catalog.pg_user WHERE usesysid =";
else
- username_subquery = "SELECT usename FROM pg_user WHERE usesysid =";
+ username_subquery = "SELECT usename FROM pg_catalog.pg_user WHERE usesysid =";
/* check the version for the synchronized snapshots feature */
if (numWorkers > 1 && fout->remoteVersion < 90200
exit_horribly(NULL,
"Exported snapshots are not supported by this server version.\n");
- /* Find the last built-in OID, if needed */
- if (fout->remoteVersion < 70300)
- {
- if (fout->remoteVersion >= 70100)
- g_last_builtin_oid = findLastBuiltinOid_V71(fout,
- PQdb(GetConnection(fout)));
- else
- g_last_builtin_oid = findLastBuiltinOid_V70(fout);
- if (g_verbose)
- write_msg(NULL, "last built-in OID is %u\n", g_last_builtin_oid);
- }
-
/* Expand schema selection patterns into OID lists */
if (schema_include_patterns.head != NULL)
{
/*
* Sort the objects into a safe dump order (no forward references).
*
- * In 7.3 or later, we can rely on dependency information to help us
- * determine a safe order, so the initial sort is mostly for cosmetic
- * purposes: we sort by name to ensure that logically identical schemas
- * will dump identically. Before 7.3 we don't have dependencies and we
- * use OID ordering as an (unreliable) guide to creation order.
+ * We rely on dependency information to help us determine a safe order, so
+ * the initial sort is mostly for cosmetic purposes: we sort by name to
+ * ensure that logically identical schemas will dump identically.
*/
- if (fout->remoteVersion >= 70300)
- sortDumpableObjectsByTypeName(dobjs, numObjs);
- else
- sortDumpableObjectsByTypeOid(dobjs, numObjs);
+ sortDumpableObjectsByTypeName(dobjs, numObjs);
/* If we do a parallel dump, we want the largest tables to go first */
if (archiveFormat == archDirectory && numWorkers > 1)
ExecuteSqlStatement(AH, "SET INTERVALSTYLE = POSTGRES");
/*
- * If supported, set extra_float_digits so that we can dump float data
- * exactly (given correctly implemented float I/O code, anyway)
+ * Set extra_float_digits so that we can dump float data exactly (given
+ * correctly implemented float I/O code, anyway)
*/
if (AH->remoteVersion >= 90000)
ExecuteSqlStatement(AH, "SET extra_float_digits TO 3");
- else if (AH->remoteVersion >= 70400)
+ else
ExecuteSqlStatement(AH, "SET extra_float_digits TO 2");
/*
/*
* Disable timeouts if supported.
*/
- if (AH->remoteVersion >= 70300)
- ExecuteSqlStatement(AH, "SET statement_timeout = 0");
+ ExecuteSqlStatement(AH, "SET statement_timeout = 0");
if (AH->remoteVersion >= 90300)
ExecuteSqlStatement(AH, "SET lock_timeout = 0");
if (AH->remoteVersion >= 90600)
"SET TRANSACTION ISOLATION LEVEL "
"REPEATABLE READ, READ ONLY");
}
- else if (AH->remoteVersion >= 70400)
+ else
{
- /* note: comma was not accepted in SET TRANSACTION before 8.0 */
ExecuteSqlStatement(AH,
"SET TRANSACTION ISOLATION LEVEL "
- "SERIALIZABLE READ ONLY");
+ "SERIALIZABLE, READ ONLY");
}
- else
- ExecuteSqlStatement(AH,
- "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE");
/*
* If user specified a snapshot to use, select that. In a parallel dump
if (patterns->head == NULL)
return; /* nothing to do */
- if (fout->remoteVersion < 70300)
- exit_horribly(NULL, "server version must be at least 7.3 to use schema selection switches\n");
-
query = createPQExpBuffer();
/*
selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name);
/*
- * If possible, specify the column list explicitly so that we have no
- * possibility of retrieving data in the wrong column order. (The default
- * column ordering of COPY will not be what we want in certain corner
- * cases involving ADD COLUMN and inheritance.)
+ * Specify the column list explicitly so that we have no possibility of
+ * retrieving data in the wrong column order. (The default column
+ * ordering of COPY will not be what we want in certain corner cases
+ * involving ADD COLUMN and inheritance.)
*/
- if (fout->remoteVersion >= 70300)
- column_list = fmtCopyColumnList(tbinfo, clistBuf);
- else
- column_list = ""; /* can't select columns in COPY */
+ column_list = fmtCopyColumnList(tbinfo, clistBuf);
if (oids && hasoids)
{
*/
selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name);
- if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(q, "DECLARE _pg_dump_cursor CURSOR FOR "
- "SELECT * FROM ONLY %s",
- fmtQualifiedId(fout->remoteVersion,
- tbinfo->dobj.namespace->dobj.name,
- classname));
- }
- else
- {
- appendPQExpBuffer(q, "DECLARE _pg_dump_cursor CURSOR FOR "
- "SELECT * FROM %s",
- fmtQualifiedId(fout->remoteVersion,
- tbinfo->dobj.namespace->dobj.name,
- classname));
- }
+ appendPQExpBuffer(q, "DECLARE _pg_dump_cursor CURSOR FOR "
+ "SELECT * FROM ONLY %s",
+ fmtQualifiedId(fout->remoteVersion,
+ tbinfo->dobj.namespace->dobj.name,
+ classname));
if (tdinfo->filtercond)
appendPQExpBuffer(q, " %s", tdinfo->filtercond);
username_subquery);
appendStringLiteralAH(dbQry, datname, fout);
}
- else if (fout->remoteVersion >= 80000)
+ else
{
appendPQExpBuffer(dbQry, "SELECT tableoid, oid, "
"(%s datdba) AS dba, "
username_subquery);
appendStringLiteralAH(dbQry, datname, fout);
}
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(dbQry, "SELECT tableoid, oid, "
- "(%s datdba) AS dba, "
- "pg_encoding_to_char(encoding) AS encoding, "
- "NULL AS datcollate, NULL AS datctype, "
- "0 AS datfrozenxid, 0 AS datminmxid, "
- "NULL AS tablespace "
- "FROM pg_database "
- "WHERE datname = ",
- username_subquery);
- appendStringLiteralAH(dbQry, datname, fout);
- }
- else
- {
- appendPQExpBuffer(dbQry, "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_database') AS tableoid, "
- "oid, "
- "(%s datdba) AS dba, "
- "pg_encoding_to_char(encoding) AS encoding, "
- "NULL AS datcollate, NULL AS datctype, "
- "0 AS datfrozenxid, 0 AS datminmxid, "
- "NULL AS tablespace "
- "FROM pg_database "
- "WHERE datname = ",
- username_subquery);
- appendStringLiteralAH(dbQry, datname, fout);
- }
res = ExecuteSqlQueryForSingleRow(fout, dbQry->data);
"NULL AS initrlomacl "
" FROM pg_largeobject_metadata",
username_subquery);
- else if (fout->remoteVersion >= 70100)
+ else
appendPQExpBufferStr(blobQry,
"SELECT DISTINCT loid AS oid, "
"NULL::name AS rolname, NULL::oid AS lomacl, "
"NULL::oid AS rlomacl, NULL::oid AS initlomacl, "
"NULL::oid AS initrlomacl "
" FROM pg_largeobject");
- else
- appendPQExpBufferStr(blobQry,
- "SELECT oid, NULL AS rolname, NULL AS lomacl, "
- "NULL AS rlomacl, NULL AS initlomacl, "
- "NULL AS initrlomacl "
- " FROM pg_class WHERE relkind = 'l'");
res = ExecuteSqlQuery(fout, blobQry->data, PGRES_TUPLES_OK);
*/
if (fout->remoteVersion >= 90000)
blobQry = "DECLARE bloboid CURSOR FOR SELECT oid FROM pg_largeobject_metadata";
- else if (fout->remoteVersion >= 70100)
- blobQry = "DECLARE bloboid CURSOR FOR SELECT DISTINCT loid FROM pg_largeobject";
else
- blobQry = "DECLARE bloboid CURSOR FOR SELECT oid FROM pg_class WHERE relkind = 'l'";
+ blobQry = "DECLARE bloboid CURSOR FOR SELECT DISTINCT loid FROM pg_largeobject";
ExecuteSqlStatement(fout, blobQry);
int i_initnspacl;
int i_initrnspacl;
- /*
- * Before 7.3, there are no real namespaces; create two dummy entries, one
- * for user stuff and one for system stuff.
- */
- if (fout->remoteVersion < 70300)
- {
- nsinfo = (NamespaceInfo *) pg_malloc(2 * sizeof(NamespaceInfo));
-
- nsinfo[0].dobj.objType = DO_NAMESPACE;
- nsinfo[0].dobj.catId.tableoid = 0;
- nsinfo[0].dobj.catId.oid = 0;
- AssignDumpId(&nsinfo[0].dobj);
- nsinfo[0].dobj.name = pg_strdup("public");
- nsinfo[0].rolname = pg_strdup("");
- nsinfo[0].nspacl = pg_strdup("");
- nsinfo[0].rnspacl = pg_strdup("");
- nsinfo[0].initnspacl = pg_strdup("");
- nsinfo[0].initrnspacl = pg_strdup("");
-
- selectDumpableNamespace(&nsinfo[0], fout);
-
- nsinfo[1].dobj.objType = DO_NAMESPACE;
- nsinfo[1].dobj.catId.tableoid = 0;
- nsinfo[1].dobj.catId.oid = 1;
- AssignDumpId(&nsinfo[1].dobj);
- nsinfo[1].dobj.name = pg_strdup("pg_catalog");
- nsinfo[1].rolname = pg_strdup("");
- nsinfo[1].nspacl = pg_strdup("");
- nsinfo[1].rnspacl = pg_strdup("");
- nsinfo[1].initnspacl = pg_strdup("");
- nsinfo[1].initrnspacl = pg_strdup("");
-
- selectDumpableNamespace(&nsinfo[1], fout);
-
- *numNamespaces = 2;
-
- return nsinfo;
- }
-
query = createPQExpBuffer();
/* Make sure we are in proper schema */
/*
* findNamespace:
- * given a namespace OID and an object OID, look up the info read by
- * getNamespaces
- *
- * NB: for pre-7.3 source database, we use object OID to guess whether it's
- * a system object or not. In 7.3 and later there is no guessing, and we
- * don't use objoid at all.
+ * given a namespace OID, look up the info read by getNamespaces
*/
static NamespaceInfo *
-findNamespace(Archive *fout, Oid nsoid, Oid objoid)
+findNamespace(Archive *fout, Oid nsoid)
{
NamespaceInfo *nsinfo;
- if (fout->remoteVersion >= 70300)
- {
- nsinfo = findNamespaceByOid(nsoid);
- }
- else
- {
- /* This code depends on the dummy objects set up by getNamespaces. */
- Oid i;
-
- if (objoid > g_last_builtin_oid)
- i = 0; /* user object */
- else
- i = 1; /* system object */
- nsinfo = findNamespaceByOid(i);
- }
-
+ nsinfo = findNamespaceByOid(nsoid);
if (nsinfo == NULL)
exit_horribly(NULL, "schema with OID %u does not exist\n", nsoid);
-
return nsinfo;
}
"FROM pg_type",
username_subquery);
}
- else if (fout->remoteVersion >= 70300)
+ else
{
appendPQExpBuffer(query, "SELECT tableoid, oid, typname, "
"typnamespace, NULL AS typacl, NULL as rtypacl, "
"FROM pg_type",
username_subquery);
}
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query, "SELECT tableoid, oid, typname, "
- "0::oid AS typnamespace, NULL AS typacl, NULL as rtypacl, "
- "NULL AS inittypacl, NULL AS initrtypacl, "
- "(%s typowner) AS rolname, "
- "typinput::oid AS typinput, "
- "typoutput::oid AS typoutput, typelem, typrelid, "
- "CASE WHEN typrelid = 0 THEN ' '::\"char\" "
- "ELSE (SELECT relkind FROM pg_class WHERE oid = typrelid) END AS typrelkind, "
- "typtype, typisdefined, "
- "typname[0] = '_' AND typelem != 0 AS isarray "
- "FROM pg_type",
- username_subquery);
- }
- else
- {
- appendPQExpBuffer(query, "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_type') AS tableoid, "
- "oid, typname, "
- "0::oid AS typnamespace, NULL AS typacl, NULL as rtypacl, "
- "NULL AS inittypacl, NULL AS initrtypacl, "
- "(%s typowner) AS rolname, "
- "typinput::oid AS typinput, "
- "typoutput::oid AS typoutput, typelem, typrelid, "
- "CASE WHEN typrelid = 0 THEN ' '::\"char\" "
- "ELSE (SELECT relkind FROM pg_class WHERE oid = typrelid) END AS typrelkind, "
- "typtype, typisdefined, "
- "typname[0] = '_' AND typelem != 0 AS isarray "
- "FROM pg_type",
- username_subquery);
- }
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
tyinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_typname));
tyinfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_typnamespace)),
- tyinfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_typnamespace)));
tyinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
tyinfo[i].typacl = pg_strdup(PQgetvalue(res, i, i_typacl));
tyinfo[i].rtypacl = pg_strdup(PQgetvalue(res, i, i_rtypacl));
* this is taken care of while sorting dependencies.
*/
stinfo->dobj.dump = DUMP_COMPONENT_NONE;
-
- /*
- * However, if dumping from pre-7.3, there will be no dependency
- * info so we have to fake it here. We only need to worry about
- * typinput and typoutput since the other functions only exist
- * post-7.3.
- */
- if (fout->remoteVersion < 70300)
- {
- Oid typinput;
- Oid typoutput;
- FuncInfo *funcInfo;
-
- typinput = atooid(PQgetvalue(res, i, i_typinput));
- typoutput = atooid(PQgetvalue(res, i, i_typoutput));
-
- funcInfo = findFuncByOid(typinput);
- if (funcInfo && funcInfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
- {
- /* base type depends on function */
- addObjectDependency(&tyinfo[i].dobj,
- funcInfo->dobj.dumpId);
- /* function depends on shell type */
- addObjectDependency(&funcInfo->dobj,
- stinfo->dobj.dumpId);
- /* mark shell type as to be dumped */
- stinfo->dobj.dump = DUMP_COMPONENT_ALL;
- }
-
- funcInfo = findFuncByOid(typoutput);
- if (funcInfo && funcInfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
- {
- /* base type depends on function */
- addObjectDependency(&tyinfo[i].dobj,
- funcInfo->dobj.dumpId);
- /* function depends on shell type */
- addObjectDependency(&funcInfo->dobj,
- stinfo->dobj.dumpId);
- /* mark shell type as to be dumped */
- stinfo->dobj.dump = DUMP_COMPONENT_ALL;
- }
- }
}
if (strlen(tyinfo[i].rolname) == 0)
/* Make sure we are in proper schema */
selectSourceSchema(fout, "pg_catalog");
- if (fout->remoteVersion >= 70300)
- {
- appendPQExpBuffer(query, "SELECT tableoid, oid, oprname, "
- "oprnamespace, "
- "(%s oprowner) AS rolname, "
- "oprkind, "
- "oprcode::oid AS oprcode "
- "FROM pg_operator",
- username_subquery);
- }
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query, "SELECT tableoid, oid, oprname, "
- "0::oid AS oprnamespace, "
- "(%s oprowner) AS rolname, "
- "oprkind, "
- "oprcode::oid AS oprcode "
- "FROM pg_operator",
- username_subquery);
- }
- else
- {
- appendPQExpBuffer(query, "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_operator') AS tableoid, "
- "oid, oprname, "
- "0::oid AS oprnamespace, "
- "(%s oprowner) AS rolname, "
- "oprkind, "
- "oprcode::oid AS oprcode "
- "FROM pg_operator",
- username_subquery);
- }
+ appendPQExpBuffer(query, "SELECT tableoid, oid, oprname, "
+ "oprnamespace, "
+ "(%s oprowner) AS rolname, "
+ "oprkind, "
+ "oprcode::oid AS oprcode "
+ "FROM pg_operator",
+ username_subquery);
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
oprinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_oprname));
oprinfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_oprnamespace)),
- oprinfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_oprnamespace)));
oprinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
oprinfo[i].oprkind = (PQgetvalue(res, i, i_oprkind))[0];
oprinfo[i].oprcode = atooid(PQgetvalue(res, i, i_oprcode));
collinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_collname));
collinfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_collnamespace)),
- collinfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_collnamespace)));
collinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
/* Decide whether we want to dump it */
int i_connamespace;
int i_rolname;
- /* Conversions didn't exist pre-7.3 */
- if (fout->remoteVersion < 70300)
- {
- *numConversions = 0;
- return NULL;
- }
-
query = createPQExpBuffer();
/*
convinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_conname));
convinfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_connamespace)),
- convinfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_connamespace)));
convinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
/* Decide whether we want to dump it */
/* Make sure we are in proper schema */
selectSourceSchema(fout, "pg_catalog");
- if (fout->remoteVersion >= 70300)
- {
- appendPQExpBuffer(query, "SELECT tableoid, oid, opcname, "
- "opcnamespace, "
- "(%s opcowner) AS rolname "
- "FROM pg_opclass",
- username_subquery);
- }
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBufferStr(query, "SELECT tableoid, oid, opcname, "
- "0::oid AS opcnamespace, "
- "''::name AS rolname "
- "FROM pg_opclass");
- }
- else
- {
- appendPQExpBufferStr(query, "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_opclass') AS tableoid, "
- "oid, opcname, "
- "0::oid AS opcnamespace, "
- "''::name AS rolname "
- "FROM pg_opclass");
- }
+ appendPQExpBuffer(query, "SELECT tableoid, oid, opcname, "
+ "opcnamespace, "
+ "(%s opcowner) AS rolname "
+ "FROM pg_opclass",
+ username_subquery);
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
opcinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_opcname));
opcinfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_opcnamespace)),
- opcinfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_opcnamespace)));
opcinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
/* Decide whether we want to dump it */
/* Op Classes do not currently have ACLs. */
opcinfo[i].dobj.dump &= ~DUMP_COMPONENT_ACL;
- if (fout->remoteVersion >= 70300)
- {
- if (strlen(opcinfo[i].rolname) == 0)
- write_msg(NULL, "WARNING: owner of operator class \"%s\" appears to be invalid\n",
- opcinfo[i].dobj.name);
- }
+ if (strlen(opcinfo[i].rolname) == 0)
+ write_msg(NULL, "WARNING: owner of operator class \"%s\" appears to be invalid\n",
+ opcinfo[i].dobj.name);
}
PQclear(res);
opfinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_opfname));
opfinfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_opfnamespace)),
- opfinfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_opfnamespace)));
opfinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
/* Decide whether we want to dump it */
/* Extensions do not currently have ACLs. */
opfinfo[i].dobj.dump &= ~DUMP_COMPONENT_ACL;
- if (fout->remoteVersion >= 70300)
- {
- if (strlen(opfinfo[i].rolname) == 0)
- write_msg(NULL, "WARNING: owner of operator family \"%s\" appears to be invalid\n",
- opfinfo[i].dobj.name);
- }
+ if (strlen(opfinfo[i].rolname) == 0)
+ write_msg(NULL, "WARNING: owner of operator family \"%s\" appears to be invalid\n",
+ opfinfo[i].dobj.name);
}
PQclear(res);
"deptype = 'e')");
appendPQExpBufferChar(query, ')');
}
- else if (fout->remoteVersion >= 70300)
+ else
{
appendPQExpBuffer(query, "SELECT tableoid, oid, proname AS aggname, "
"pronamespace AS aggnamespace, "
"(SELECT oid FROM pg_namespace WHERE nspname = 'pg_catalog')",
username_subquery);
}
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query, "SELECT tableoid, oid, aggname, "
- "0::oid AS aggnamespace, "
- "CASE WHEN aggbasetype = 0 THEN 0 ELSE 1 END AS pronargs, "
- "aggbasetype AS proargtypes, "
- "(%s aggowner) AS rolname, "
- "NULL AS aggacl, "
- "NULL AS raggacl, "
- "NULL AS initaggacl, NULL AS initraggacl "
- "FROM pg_aggregate "
- "where oid > '%u'::oid",
- username_subquery,
- g_last_builtin_oid);
- }
- else
- {
- appendPQExpBuffer(query, "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_aggregate') AS tableoid, "
- "oid, aggname, "
- "0::oid AS aggnamespace, "
- "CASE WHEN aggbasetype = 0 THEN 0 ELSE 1 END AS pronargs, "
- "aggbasetype AS proargtypes, "
- "(%s aggowner) AS rolname, "
- "NULL AS aggacl, "
- "NULL AS raggacl, "
- "NULL AS initaggacl, NULL AS initraggacl "
- "FROM pg_aggregate "
- "where oid > '%u'::oid",
- username_subquery,
- g_last_builtin_oid);
- }
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
agginfo[i].aggfn.dobj.name = pg_strdup(PQgetvalue(res, i, i_aggname));
agginfo[i].aggfn.dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_aggnamespace)),
- agginfo[i].aggfn.dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_aggnamespace)));
agginfo[i].aggfn.rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
if (strlen(agginfo[i].aggfn.rolname) == 0)
write_msg(NULL, "WARNING: owner of aggregate function \"%s\" appears to be invalid\n",
else
{
agginfo[i].aggfn.argtypes = (Oid *) pg_malloc(agginfo[i].aggfn.nargs * sizeof(Oid));
- if (fout->remoteVersion >= 70300)
- parseOidArray(PQgetvalue(res, i, i_proargtypes),
- agginfo[i].aggfn.argtypes,
- agginfo[i].aggfn.nargs);
- else
- /* it's just aggbasetype */
- agginfo[i].aggfn.argtypes[0] = atooid(PQgetvalue(res, i, i_proargtypes));
+ parseOidArray(PQgetvalue(res, i, i_proargtypes),
+ agginfo[i].aggfn.argtypes,
+ agginfo[i].aggfn.nargs);
}
/* Decide whether we want to dump it */
destroyPQExpBuffer(initacl_subquery);
destroyPQExpBuffer(initracl_subquery);
}
- else if (fout->remoteVersion >= 70300)
+ else
{
appendPQExpBuffer(query,
"SELECT tableoid, oid, proname, prolang, "
"deptype = 'e')");
appendPQExpBufferChar(query, ')');
}
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query,
- "SELECT tableoid, oid, proname, prolang, "
- "pronargs, proargtypes, prorettype, "
- "NULL AS proacl, "
- "NULL AS rproacl, "
- "NULL as initproacl, NULL AS initrproacl, "
- "0::oid AS pronamespace, "
- "(%s proowner) AS rolname "
- "FROM pg_proc "
- "WHERE pg_proc.oid > '%u'::oid",
- username_subquery,
- g_last_builtin_oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT "
- "(SELECT oid FROM pg_class "
- " WHERE relname = 'pg_proc') AS tableoid, "
- "oid, proname, prolang, "
- "pronargs, proargtypes, prorettype, "
- "NULL AS proacl, "
- "NULL AS rproacl, "
- "NULL as initproacl, NULL AS initrproacl, "
- "0::oid AS pronamespace, "
- "(%s proowner) AS rolname "
- "FROM pg_proc "
- "where pg_proc.oid > '%u'::oid",
- username_subquery,
- g_last_builtin_oid);
- }
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
finfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_proname));
finfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_pronamespace)),
- finfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_pronamespace)));
finfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
finfo[i].lang = atooid(PQgetvalue(res, i, i_prolang));
finfo[i].prorettype = atooid(PQgetvalue(res, i, i_prorettype));
RELKIND_RELATION, RELKIND_SEQUENCE,
RELKIND_VIEW, RELKIND_COMPOSITE_TYPE);
}
- else if (fout->remoteVersion >= 80000)
+ else
{
/*
* Left join to pick up dependency info linking sequences to their
RELKIND_RELATION, RELKIND_SEQUENCE,
RELKIND_VIEW, RELKIND_COMPOSITE_TYPE);
}
- else if (fout->remoteVersion >= 70300)
- {
- /*
- * Left join to pick up dependency info linking sequences to their
- * owning column, if any
- */
- appendPQExpBuffer(query,
- "SELECT c.tableoid, c.oid, relname, "
- "relacl, NULL as rrelacl, "
- "NULL AS initrelacl, NULL AS initrrelacl, "
- "relkind, relnamespace, "
- "(%s relowner) AS rolname, "
- "relchecks, (reltriggers <> 0) AS relhastriggers, "
- "relhasindex, relhasrules, relhasoids, "
- "'f'::bool AS relrowsecurity, "
- "'f'::bool AS relforcerowsecurity, "
- "0 AS relfrozenxid, 0 AS relminmxid,"
- "0 AS toid, "
- "0 AS tfrozenxid, 0 AS tminmxid,"
- "'p' AS relpersistence, 't' as relispopulated, "
- "'d' AS relreplident, relpages, "
- "NULL AS reloftype, "
- "d.refobjid AS owning_tab, "
- "d.refobjsubid AS owning_col, "
- "NULL AS reltablespace, "
- "NULL AS reloptions, "
- "NULL AS toast_reloptions, "
- "NULL AS changed_acl "
- "FROM pg_class c "
- "LEFT JOIN pg_depend d ON "
- "(c.relkind = '%c' AND "
- "d.classid = c.tableoid AND d.objid = c.oid AND "
- "d.objsubid = 0 AND "
- "d.refclassid = c.tableoid AND d.deptype = 'i') "
- "WHERE relkind IN ('%c', '%c', '%c', '%c') "
- "ORDER BY c.oid",
- username_subquery,
- RELKIND_SEQUENCE,
- RELKIND_RELATION, RELKIND_SEQUENCE,
- RELKIND_VIEW, RELKIND_COMPOSITE_TYPE);
- }
- else if (fout->remoteVersion >= 70200)
- {
- appendPQExpBuffer(query,
- "SELECT tableoid, oid, relname, relacl, "
- "NULL as rrelacl, "
- "NULL AS initrelacl, NULL AS initrrelacl, "
- "relkind, "
- "0::oid AS relnamespace, "
- "(%s relowner) AS rolname, "
- "relchecks, (reltriggers <> 0) AS relhastriggers, "
- "relhasindex, relhasrules, relhasoids, "
- "'f'::bool AS relrowsecurity, "
- "'f'::bool AS relforcerowsecurity, "
- "0 AS relfrozenxid, 0 AS relminmxid,"
- "0 AS toid, "
- "0 AS tfrozenxid, 0 AS tminmxid,"
- "'p' AS relpersistence, 't' as relispopulated, "
- "'d' AS relreplident, relpages, "
- "NULL AS reloftype, "
- "NULL::oid AS owning_tab, "
- "NULL::int4 AS owning_col, "
- "NULL AS reltablespace, "
- "NULL AS reloptions, "
- "NULL AS toast_reloptions, "
- "NULL AS changed_acl "
- "FROM pg_class "
- "WHERE relkind IN ('%c', '%c', '%c') "
- "ORDER BY oid",
- username_subquery,
- RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
- }
- else if (fout->remoteVersion >= 70100)
- {
- /* all tables have oids in 7.1 */
- appendPQExpBuffer(query,
- "SELECT tableoid, oid, relname, relacl, "
- "NULL as rrelacl, "
- "NULL AS initrelacl, NULL AS initrrelacl, "
- "relkind, "
- "0::oid AS relnamespace, "
- "(%s relowner) AS rolname, "
- "relchecks, (reltriggers <> 0) AS relhastriggers, "
- "relhasindex, relhasrules, "
- "'t'::bool AS relhasoids, "
- "'f'::bool AS relrowsecurity, "
- "'f'::bool AS relforcerowsecurity, "
- "0 AS relfrozenxid, 0 AS relminmxid,"
- "0 AS toid, "
- "0 AS tfrozenxid, 0 AS tminmxid,"
- "'p' AS relpersistence, 't' as relispopulated, "
- "'d' AS relreplident, relpages, "
- "NULL AS reloftype, "
- "NULL::oid AS owning_tab, "
- "NULL::int4 AS owning_col, "
- "NULL AS reltablespace, "
- "NULL AS reloptions, "
- "NULL AS toast_reloptions, "
- "NULL AS changed_acl "
- "FROM pg_class "
- "WHERE relkind IN ('%c', '%c', '%c') "
- "ORDER BY oid",
- username_subquery,
- RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
- }
- else
- {
- /*
- * Before 7.1, view relkind was not set to 'v', so we must check if we
- * have a view by looking for a rule in pg_rewrite.
- */
- appendPQExpBuffer(query,
- "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_class') AS tableoid, "
- "oid, relname, relacl, NULL as rrelacl, "
- "NULL AS initrelacl, NULL AS initrrelacl, "
- "CASE WHEN relhasrules and relkind = 'r' "
- " and EXISTS(SELECT rulename FROM pg_rewrite r WHERE "
- " r.ev_class = c.oid AND r.ev_type = '1') "
- "THEN '%c'::\"char\" "
- "ELSE relkind END AS relkind,"
- "0::oid AS relnamespace, "
- "(%s relowner) AS rolname, "
- "relchecks, (reltriggers <> 0) AS relhastriggers, "
- "relhasindex, relhasrules, "
- "'t'::bool AS relhasoids, "
- "'f'::bool AS relrowsecurity, "
- "'f'::bool AS relforcerowsecurity, "
- "0 AS relfrozenxid, 0 AS relminmxid,"
- "0 AS toid, "
- "0 AS tfrozenxid, 0 AS tminmxid,"
- "'p' AS relpersistence, 't' as relispopulated, "
- "'d' AS relreplident, 0 AS relpages, "
- "NULL AS reloftype, "
- "NULL::oid AS owning_tab, "
- "NULL::int4 AS owning_col, "
- "NULL AS reltablespace, "
- "NULL AS reloptions, "
- "NULL AS toast_reloptions, "
- "NULL AS changed_acl "
- "FROM pg_class c "
- "WHERE relkind IN ('%c', '%c') "
- "ORDER BY oid",
- RELKIND_VIEW,
- username_subquery,
- RELKIND_RELATION, RELKIND_SEQUENCE);
- }
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
i_reloftype = PQfnumber(res, "reloftype");
i_changed_acl = PQfnumber(res, "changed_acl");
- if (dopt->lockWaitTimeout && fout->remoteVersion >= 70300)
+ if (dopt->lockWaitTimeout)
{
/*
* Arrange to fail instead of waiting forever for a table lock.
tblinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_relname));
tblinfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_relnamespace)),
- tblinfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_relnamespace)));
tblinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
tblinfo[i].relacl = pg_strdup(PQgetvalue(res, i, i_relacl));
tblinfo[i].rrelacl = pg_strdup(PQgetvalue(res, i, i_rrelacl));
tblinfo[i].dobj.name);
}
- if (dopt->lockWaitTimeout && fout->remoteVersion >= 70300)
+ if (dopt->lockWaitTimeout)
{
ExecuteSqlStatement(fout, "SET statement_timeout = 0");
}
"ORDER BY indexname",
tbinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 80000)
+ else
{
appendPQExpBuffer(query,
"SELECT t.tableoid, t.oid, "
"ORDER BY indexname",
tbinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70300)
- {
- appendPQExpBuffer(query,
- "SELECT t.tableoid, t.oid, "
- "t.relname AS indexname, "
- "pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, "
- "t.relnatts AS indnkeys, "
- "i.indkey, i.indisclustered, "
- "false AS indisreplident, t.relpages, "
- "c.contype, c.conname, "
- "c.condeferrable, c.condeferred, "
- "c.tableoid AS contableoid, "
- "c.oid AS conoid, "
- "null AS condef, "
- "NULL AS tablespace, "
- "null AS indreloptions "
- "FROM pg_catalog.pg_index i "
- "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) "
- "LEFT JOIN pg_catalog.pg_depend d "
- "ON (d.classid = t.tableoid "
- "AND d.objid = t.oid "
- "AND d.deptype = 'i') "
- "LEFT JOIN pg_catalog.pg_constraint c "
- "ON (d.refclassid = c.tableoid "
- "AND d.refobjid = c.oid) "
- "WHERE i.indrelid = '%u'::pg_catalog.oid "
- "ORDER BY indexname",
- tbinfo->dobj.catId.oid);
- }
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query,
- "SELECT t.tableoid, t.oid, "
- "t.relname AS indexname, "
- "pg_get_indexdef(i.indexrelid) AS indexdef, "
- "t.relnatts AS indnkeys, "
- "i.indkey, false AS indisclustered, "
- "false AS indisreplident, t.relpages, "
- "CASE WHEN i.indisprimary THEN 'p'::char "
- "ELSE '0'::char END AS contype, "
- "t.relname AS conname, "
- "false AS condeferrable, "
- "false AS condeferred, "
- "0::oid AS contableoid, "
- "t.oid AS conoid, "
- "null AS condef, "
- "NULL AS tablespace, "
- "null AS indreloptions "
- "FROM pg_index i, pg_class t "
- "WHERE t.oid = i.indexrelid "
- "AND i.indrelid = '%u'::oid "
- "ORDER BY indexname",
- tbinfo->dobj.catId.oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_class') AS tableoid, "
- "t.oid, "
- "t.relname AS indexname, "
- "pg_get_indexdef(i.indexrelid) AS indexdef, "
- "t.relnatts AS indnkeys, "
- "i.indkey, false AS indisclustered, "
- "false AS indisreplident, t.relpages, "
- "CASE WHEN i.indisprimary THEN 'p'::char "
- "ELSE '0'::char END AS contype, "
- "t.relname AS conname, "
- "false AS condeferrable, "
- "false AS condeferred, "
- "0::oid AS contableoid, "
- "t.oid AS conoid, "
- "null AS condef, "
- "NULL AS tablespace, "
- "null AS indreloptions "
- "FROM pg_index i, pg_class t "
- "WHERE t.oid = i.indexrelid "
- "AND i.indrelid = '%u'::oid "
- "ORDER BY indexname",
- tbinfo->dobj.catId.oid);
- }
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
indxinfo[j].indnkeys = atoi(PQgetvalue(res, j, i_indnkeys));
indxinfo[j].tablespace = pg_strdup(PQgetvalue(res, j, i_tablespace));
indxinfo[j].indreloptions = pg_strdup(PQgetvalue(res, j, i_indreloptions));
-
- /*
- * In pre-7.4 releases, indkeys may contain more entries than
- * indnkeys says (since indnkeys will be 1 for a functional
- * index). We don't actually care about this case since we don't
- * examine indkeys except for indexes associated with PRIMARY and
- * UNIQUE constraints, which are never functional indexes. But we
- * have to allocate enough space to keep parseOidArray from
- * complaining.
- */
- indxinfo[j].indkeys = (Oid *) pg_malloc(INDEX_MAX_KEYS * sizeof(Oid));
+ indxinfo[j].indkeys = (Oid *) pg_malloc(indxinfo[j].indnkeys * sizeof(Oid));
parseOidArray(PQgetvalue(res, j, i_indkey),
- indxinfo[j].indkeys, INDEX_MAX_KEYS);
+ indxinfo[j].indkeys, indxinfo[j].indnkeys);
indxinfo[j].indisclustered = (PQgetvalue(res, j, i_indisclustered)[0] == 't');
indxinfo[j].indisreplident = (PQgetvalue(res, j, i_indisreplident)[0] == 't');
indxinfo[j].relpages = atoi(PQgetvalue(res, j, i_relpages));
/*
* If we found a constraint matching the index, create an
* entry for it.
- *
- * In a pre-7.3 database, we take this path iff the index was
- * marked indisprimary.
*/
constrinfo[j].dobj.objType = DO_CONSTRAINT;
constrinfo[j].dobj.catId.tableoid = atooid(PQgetvalue(res, j, i_contableoid));
constrinfo[j].separate = true;
indxinfo[j].indexconstraint = constrinfo[j].dobj.dumpId;
-
- /* If pre-7.3 DB, better make sure table comes first */
- addObjectDependency(&constrinfo[j].dobj,
- tbinfo->dobj.dumpId);
}
else
{
i_condef;
int ntups;
- /* pg_constraint was created in 7.3, so nothing to do if older */
- if (fout->remoteVersion < 70300)
- return;
-
query = createPQExpBuffer();
for (i = 0; i < numTables; i++)
i_consrc;
int ntups;
- /* pg_constraint was created in 7.3, so nothing to do if older */
- if (fout->remoteVersion < 70300)
- return;
-
/*
* select appropriate schema to ensure names in constraint are properly
* qualified
"ORDER BY conname",
tyinfo->dobj.catId.oid);
- else if (fout->remoteVersion >= 70400)
- appendPQExpBuffer(query, "SELECT tableoid, oid, conname, "
- "pg_catalog.pg_get_constraintdef(oid) AS consrc, "
- "true as convalidated "
- "FROM pg_catalog.pg_constraint "
- "WHERE contypid = '%u'::pg_catalog.oid "
- "ORDER BY conname",
- tyinfo->dobj.catId.oid);
else
appendPQExpBuffer(query, "SELECT tableoid, oid, conname, "
- "'CHECK (' || consrc || ')' AS consrc, "
+ "pg_catalog.pg_get_constraintdef(oid) AS consrc, "
"true as convalidated "
"FROM pg_catalog.pg_constraint "
"WHERE contypid = '%u'::pg_catalog.oid "
"FROM pg_rewrite "
"ORDER BY oid");
}
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBufferStr(query, "SELECT "
- "tableoid, oid, rulename, "
- "ev_class AS ruletable, ev_type, is_instead, "
- "'O'::char AS ev_enabled "
- "FROM pg_rewrite "
- "ORDER BY oid");
- }
else
{
appendPQExpBufferStr(query, "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_rewrite') AS tableoid, "
- "oid, rulename, "
+ "tableoid, oid, rulename, "
"ev_class AS ruletable, ev_type, is_instead, "
"'O'::char AS ev_enabled "
"FROM pg_rewrite "
"AND tgconstraint = 0",
tbinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70300)
+ else
{
/*
* We ignore triggers that are tied to a foreign-key constraint,
" WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND c.contype = 'f'))",
tbinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query,
- "SELECT tgname, tgfoid::regproc AS tgfname, "
- "tgtype, tgnargs, tgargs, tgenabled, "
- "tgisconstraint, tgconstrname, tgdeferrable, "
- "tgconstrrelid, tginitdeferred, tableoid, oid, "
- "(SELECT relname FROM pg_class WHERE oid = tgconstrrelid) "
- " AS tgconstrrelname "
- "FROM pg_trigger "
- "WHERE tgrelid = '%u'::oid",
- tbinfo->dobj.catId.oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT tgname, tgfoid::regproc AS tgfname, "
- "tgtype, tgnargs, tgargs, tgenabled, "
- "tgisconstraint, tgconstrname, tgdeferrable, "
- "tgconstrrelid, tginitdeferred, "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_trigger') AS tableoid, "
- "oid, "
- "(SELECT relname FROM pg_class WHERE oid = tgconstrrelid) "
- " AS tgconstrrelname "
- "FROM pg_trigger "
- "WHERE tgrelid = '%u'::oid",
- tbinfo->dobj.catId.oid);
- }
+
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
ntups = PQntuples(res);
"ORDER BY oid",
username_subquery);
}
- else if (fout->remoteVersion >= 70400)
+ else
{
/* Languages are owned by the bootstrap superuser, sysid 1 */
appendPQExpBuffer(query, "SELECT tableoid, oid, "
"ORDER BY oid",
username_subquery);
}
- else if (fout->remoteVersion >= 70300)
- {
- /* No clear notion of an owner at all before 7.4 ... */
- appendPQExpBuffer(query, "SELECT tableoid, oid, "
- "lanname, lanpltrusted, lanplcallfoid, "
- "0 AS laninline, lanvalidator, lanacl, "
- "NULL AS rlanacl, "
- "NULL AS initlanacl, NULL AS initrlanacl, "
- "NULL AS lanowner "
- "FROM pg_language "
- "WHERE lanispl "
- "ORDER BY oid");
- }
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query, "SELECT tableoid, oid, "
- "lanname, lanpltrusted, lanplcallfoid, "
- "0 AS laninline, 0 AS lanvalidator, NULL AS lanacl, "
- "NULL AS rlanacl, "
- "NULL AS initlanacl, NULL AS initrlanacl, "
- "NULL AS lanowner "
- "FROM pg_language "
- "WHERE lanispl "
- "ORDER BY oid");
- }
- else
- {
- appendPQExpBuffer(query, "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_language') AS tableoid, "
- "oid, "
- "lanname, lanpltrusted, lanplcallfoid, "
- "0 AS laninline, 0 AS lanvalidator, NULL AS lanacl, "
- "NULL AS rlanacl, "
- "NULL AS initlanacl, NULL AS initrlanacl, "
- "NULL AS lanowner "
- "FROM pg_language "
- "WHERE lanispl "
- "ORDER BY oid");
- }
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
PQgetisnull(res, i, i_initlanacl) &&
PQgetisnull(res, i, i_initrlanacl))
planginfo[i].dobj.dump &= ~DUMP_COMPONENT_ACL;
-
- if (fout->remoteVersion < 70300)
- {
- /*
- * We need to make a dependency to ensure the function will be
- * dumped first. (In 7.3 and later the regular dependency
- * mechanism will handle this for us.)
- */
- FuncInfo *funcInfo = findFuncByOid(planginfo[i].lanplcallfoid);
-
- if (funcInfo)
- addObjectDependency(&planginfo[i].dobj,
- funcInfo->dobj.dumpId);
- }
}
PQclear(res);
"castmethod "
"FROM pg_cast ORDER BY 3,4");
}
- else if (fout->remoteVersion >= 70300)
+ else
{
appendPQExpBufferStr(query, "SELECT tableoid, oid, "
"castsource, casttarget, castfunc, castcontext, "
"CASE WHEN castfunc = 0 THEN 'b' ELSE 'f' END AS castmethod "
"FROM pg_cast ORDER BY 3,4");
}
- else
- {
- appendPQExpBufferStr(query, "SELECT 0 AS tableoid, p.oid, "
- "t1.oid AS castsource, t2.oid AS casttarget, "
- "p.oid AS castfunc, 'e' AS castcontext, "
- "'f' AS castmethod "
- "FROM pg_type t1, pg_type t2, pg_proc p "
- "WHERE p.pronargs = 1 AND "
- "p.proargtypes[0] = t1.oid AND "
- "p.prorettype = t2.oid AND p.proname = t2.typname "
- "ORDER BY 3,4");
- }
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
sTypeInfo->dobj.name, tTypeInfo->dobj.name);
castinfo[i].dobj.name = namebuf.data;
- if (fout->remoteVersion < 70300 &&
- OidIsValid(castinfo[i].castfunc))
- {
- /*
- * We need to make a dependency to ensure the function will be
- * dumped first. (In 7.3 and later the regular dependency
- * mechanism handles this for us.)
- */
- FuncInfo *funcInfo;
-
- funcInfo = findFuncByOid(castinfo[i].castfunc);
- if (funcInfo)
- addObjectDependency(&castinfo[i].dobj,
- funcInfo->dobj.dumpId);
- }
-
/* Decide whether we want to dump it */
selectDumpableCast(&(castinfo[i]), fout);
/*
* we must read the attribute names in attribute number order! because
- * we will use the attnum to index into the attnames array later. We
- * actually ask to order by "attrelid, attnum" because (at least up to
- * 7.3) the planner is not smart enough to realize it needn't re-sort
- * the output of an indexscan on pg_attribute_relid_attnum_index.
+ * we will use the attnum to index into the attnames array later.
*/
if (g_verbose)
write_msg(NULL, "finding the columns and types of table \"%s.%s\"\n",
"ON a.atttypid = t.oid "
"WHERE a.attrelid = '%u'::pg_catalog.oid "
"AND a.attnum > 0::pg_catalog.int2 "
- "ORDER BY a.attrelid, a.attnum",
+ "ORDER BY a.attnum",
tbinfo->dobj.catId.oid);
}
else if (fout->remoteVersion >= 90100)
"ON a.atttypid = t.oid "
"WHERE a.attrelid = '%u'::pg_catalog.oid "
"AND a.attnum > 0::pg_catalog.int2 "
- "ORDER BY a.attrelid, a.attnum",
+ "ORDER BY a.attnum",
tbinfo->dobj.catId.oid);
}
else if (fout->remoteVersion >= 90000)
"ON a.atttypid = t.oid "
"WHERE a.attrelid = '%u'::pg_catalog.oid "
"AND a.attnum > 0::pg_catalog.int2 "
- "ORDER BY a.attrelid, a.attnum",
+ "ORDER BY a.attnum",
tbinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70300)
+ else
{
/* need left join here to not fail on dropped columns ... */
appendPQExpBuffer(q, "SELECT a.attnum, a.attname, a.atttypmod, "
"ON a.atttypid = t.oid "
"WHERE a.attrelid = '%u'::pg_catalog.oid "
"AND a.attnum > 0::pg_catalog.int2 "
- "ORDER BY a.attrelid, a.attnum",
- tbinfo->dobj.catId.oid);
- }
- else if (fout->remoteVersion >= 70100)
- {
- /*
- * attstattarget doesn't exist in 7.1. It does exist in 7.2, but
- * we don't dump it because we can't tell whether it's been
- * explicitly set or was just a default.
- *
- * attislocal doesn't exist before 7.3, either; in older databases
- * we assume it's TRUE, else we'd fail to dump non-inherited atts.
- */
- appendPQExpBuffer(q, "SELECT a.attnum, a.attname, a.atttypmod, "
- "-1 AS attstattarget, a.attstorage, "
- "t.typstorage, a.attnotnull, a.atthasdef, "
- "false AS attisdropped, a.attlen, "
- "a.attalign, true AS attislocal, "
- "format_type(t.oid,a.atttypmod) AS atttypname, "
- "'' AS attoptions, 0 AS attcollation, "
- "NULL AS attfdwoptions "
- "FROM pg_attribute a LEFT JOIN pg_type t "
- "ON a.atttypid = t.oid "
- "WHERE a.attrelid = '%u'::oid "
- "AND a.attnum > 0::int2 "
- "ORDER BY a.attrelid, a.attnum",
- tbinfo->dobj.catId.oid);
- }
- else
- {
- /* format_type not available before 7.1 */
- appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, "
- "-1 AS attstattarget, "
- "attstorage, attstorage AS typstorage, "
- "attnotnull, atthasdef, false AS attisdropped, "
- "attlen, attalign, "
- "true AS attislocal, "
- "(SELECT typname FROM pg_type WHERE oid = atttypid) AS atttypname, "
- "'' AS attoptions, 0 AS attcollation, "
- "NULL AS attfdwoptions "
- "FROM pg_attribute a "
- "WHERE attrelid = '%u'::oid "
- "AND attnum > 0::int2 "
- "ORDER BY attrelid, attnum",
+ "ORDER BY a.attnum",
tbinfo->dobj.catId.oid);
}
tbinfo->dobj.namespace->dobj.name,
tbinfo->dobj.name);
- resetPQExpBuffer(q);
- if (fout->remoteVersion >= 70300)
- {
- appendPQExpBuffer(q, "SELECT tableoid, oid, adnum, "
+ printfPQExpBuffer(q, "SELECT tableoid, oid, adnum, "
"pg_catalog.pg_get_expr(adbin, adrelid) AS adsrc "
- "FROM pg_catalog.pg_attrdef "
- "WHERE adrelid = '%u'::pg_catalog.oid",
- tbinfo->dobj.catId.oid);
- }
- else if (fout->remoteVersion >= 70200)
- {
- /* 7.2 did not have OIDs in pg_attrdef */
- appendPQExpBuffer(q, "SELECT tableoid, 0 AS oid, adnum, "
- "pg_get_expr(adbin, adrelid) AS adsrc "
- "FROM pg_attrdef "
- "WHERE adrelid = '%u'::oid",
- tbinfo->dobj.catId.oid);
- }
- else if (fout->remoteVersion >= 70100)
- {
- /* no pg_get_expr, so must rely on adsrc */
- appendPQExpBuffer(q, "SELECT tableoid, oid, adnum, adsrc "
- "FROM pg_attrdef "
- "WHERE adrelid = '%u'::oid",
- tbinfo->dobj.catId.oid);
- }
- else
- {
- /* no pg_get_expr, no tableoid either */
- appendPQExpBuffer(q, "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_attrdef') AS tableoid, "
- "oid, adnum, adsrc "
- "FROM pg_attrdef "
- "WHERE adrelid = '%u'::oid",
- tbinfo->dobj.catId.oid);
- }
+ "FROM pg_catalog.pg_attrdef "
+ "WHERE adrelid = '%u'::pg_catalog.oid",
+ tbinfo->dobj.catId.oid);
+
res = ExecuteSqlQuery(fout, q->data, PGRES_TUPLES_OK);
numDefaults = PQntuples(res);
if (tbinfo->relkind == RELKIND_VIEW)
{
attrdefs[j].separate = true;
- /* needed in case pre-7.3 DB: */
- addObjectDependency(&attrdefs[j].dobj,
- tbinfo->dobj.dumpId);
}
else if (!shouldPrintColumn(dopt, tbinfo, adnum - 1))
{
/* column will be suppressed, print default separately */
attrdefs[j].separate = true;
- /* needed in case pre-7.3 DB: */
- addObjectDependency(&attrdefs[j].dobj,
- tbinfo->dobj.dumpId);
}
else
{
"ORDER BY conname",
tbinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70400)
+ else
{
appendPQExpBuffer(q, "SELECT tableoid, oid, conname, "
"pg_catalog.pg_get_constraintdef(oid) AS consrc, "
"ORDER BY conname",
tbinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70300)
- {
- /* no pg_get_constraintdef, must use consrc */
- appendPQExpBuffer(q, "SELECT tableoid, oid, conname, "
- "'CHECK (' || consrc || ')' AS consrc, "
- "true AS conislocal, true AS convalidated "
- "FROM pg_catalog.pg_constraint "
- "WHERE conrelid = '%u'::pg_catalog.oid "
- " AND contype = 'c' "
- "ORDER BY conname",
- tbinfo->dobj.catId.oid);
- }
- else if (fout->remoteVersion >= 70200)
- {
- /* 7.2 did not have OIDs in pg_relcheck */
- appendPQExpBuffer(q, "SELECT tableoid, 0 AS oid, "
- "rcname AS conname, "
- "'CHECK (' || rcsrc || ')' AS consrc, "
- "true AS conislocal, true AS convalidated "
- "FROM pg_relcheck "
- "WHERE rcrelid = '%u'::oid "
- "ORDER BY rcname",
- tbinfo->dobj.catId.oid);
- }
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(q, "SELECT tableoid, oid, "
- "rcname AS conname, "
- "'CHECK (' || rcsrc || ')' AS consrc, "
- "true AS conislocal, true AS convalidated "
- "FROM pg_relcheck "
- "WHERE rcrelid = '%u'::oid "
- "ORDER BY rcname",
- tbinfo->dobj.catId.oid);
- }
- else
- {
- /* no tableoid in 7.0 */
- appendPQExpBuffer(q, "SELECT "
- "(SELECT oid FROM pg_class WHERE relname = 'pg_relcheck') AS tableoid, "
- "oid, rcname AS conname, "
- "'CHECK (' || rcsrc || ')' AS consrc, "
- "true AS conislocal, true AS convalidated "
- "FROM pg_relcheck "
- "WHERE rcrelid = '%u'::oid "
- "ORDER BY rcname",
- tbinfo->dobj.catId.oid);
- }
+
res = ExecuteSqlQuery(fout, q->data, PGRES_TUPLES_OK);
numConstrs = PQntuples(res);
prsinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_prsname));
prsinfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_prsnamespace)),
- prsinfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_prsnamespace)));
prsinfo[i].prsstart = atooid(PQgetvalue(res, i, i_prsstart));
prsinfo[i].prstoken = atooid(PQgetvalue(res, i, i_prstoken));
prsinfo[i].prsend = atooid(PQgetvalue(res, i, i_prsend));
dictinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_dictname));
dictinfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_dictnamespace)),
- dictinfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_dictnamespace)));
dictinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
dictinfo[i].dicttemplate = atooid(PQgetvalue(res, i, i_dicttemplate));
if (PQgetisnull(res, i, i_dictinitoption))
tmplinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_tmplname));
tmplinfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_tmplnamespace)),
- tmplinfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_tmplnamespace)));
tmplinfo[i].tmplinit = atooid(PQgetvalue(res, i, i_tmplinit));
tmplinfo[i].tmpllexize = atooid(PQgetvalue(res, i, i_tmpllexize));
cfginfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_cfgname));
cfginfo[i].dobj.namespace =
findNamespace(fout,
- atooid(PQgetvalue(res, i, i_cfgnamespace)),
- cfginfo[i].dobj.catId.oid);
+ atooid(PQgetvalue(res, i, i_cfgnamespace)));
cfginfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
cfginfo[i].cfgparser = atooid(PQgetvalue(res, i, i_cfgparser));
daclinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_defaclobjtype));
if (nspid != InvalidOid)
- daclinfo[i].dobj.namespace = findNamespace(fout, nspid,
- daclinfo[i].dobj.catId.oid);
+ daclinfo[i].dobj.namespace = findNamespace(fout, nspid);
else
daclinfo[i].dobj.namespace = NULL;
if (ncomments < 0)
ncomments = collectComments(fout, &comments);
- /*
- * Pre-7.2, pg_description does not contain classoid, so collectComments
- * just stores a zero. If there's a collision on object OID, well, you
- * get duplicate comments.
- */
- if (fout->remoteVersion < 70200)
- classoid = 0;
-
/*
* Do binary search to find some item matching the object.
*/
query = createPQExpBuffer();
- if (fout->remoteVersion >= 70300)
- {
- appendPQExpBufferStr(query, "SELECT description, classoid, objoid, objsubid "
- "FROM pg_catalog.pg_description "
- "ORDER BY classoid, objoid, objsubid");
- }
- else if (fout->remoteVersion >= 70200)
- {
- appendPQExpBufferStr(query, "SELECT description, classoid, objoid, objsubid "
- "FROM pg_description "
- "ORDER BY classoid, objoid, objsubid");
- }
- else
- {
- /* Note: this will fail to find attribute comments in pre-7.2... */
- appendPQExpBufferStr(query, "SELECT description, 0 AS classoid, objoid, 0 AS objsubid "
- "FROM pg_description "
- "ORDER BY objoid");
- }
+ appendPQExpBufferStr(query, "SELECT description, classoid, objoid, objsubid "
+ "FROM pg_catalog.pg_description "
+ "ORDER BY classoid, objoid, objsubid");
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
if (!nspinfo->dobj.dump || dopt->dataOnly)
return;
- /* don't dump dummy namespace from pre-7.3 source */
- if (strlen(nspinfo->dobj.name) == 0)
- return;
-
q = createPQExpBuffer();
delq = createPQExpBuffer();
labelq = createPQExpBuffer();
"WHERE oid = '%u'::pg_catalog.oid",
tyinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 80400)
- {
- appendPQExpBuffer(query, "SELECT typlen, "
- "typinput, typoutput, typreceive, typsend, "
- "typmodin, typmodout, typanalyze, "
- "typreceive::pg_catalog.oid AS typreceiveoid, "
- "typsend::pg_catalog.oid AS typsendoid, "
- "typmodin::pg_catalog.oid AS typmodinoid, "
- "typmodout::pg_catalog.oid AS typmodoutoid, "
- "typanalyze::pg_catalog.oid AS typanalyzeoid, "
- "typcategory, typispreferred, "
- "typdelim, typbyval, typalign, typstorage, "
- "false AS typcollatable, "
- "pg_catalog.pg_get_expr(typdefaultbin, 0) AS typdefaultbin, typdefault "
- "FROM pg_catalog.pg_type "
- "WHERE oid = '%u'::pg_catalog.oid",
- tyinfo->dobj.catId.oid);
- }
- else if (fout->remoteVersion >= 80300)
- {
- /* Before 8.4, pg_get_expr does not allow 0 for its second arg */
- appendPQExpBuffer(query, "SELECT typlen, "
- "typinput, typoutput, typreceive, typsend, "
- "typmodin, typmodout, typanalyze, "
- "typreceive::pg_catalog.oid AS typreceiveoid, "
- "typsend::pg_catalog.oid AS typsendoid, "
- "typmodin::pg_catalog.oid AS typmodinoid, "
- "typmodout::pg_catalog.oid AS typmodoutoid, "
- "typanalyze::pg_catalog.oid AS typanalyzeoid, "
- "'U' AS typcategory, false AS typispreferred, "
- "typdelim, typbyval, typalign, typstorage, "
- "false AS typcollatable, "
- "pg_catalog.pg_get_expr(typdefaultbin, 'pg_catalog.pg_type'::pg_catalog.regclass) AS typdefaultbin, typdefault "
- "FROM pg_catalog.pg_type "
- "WHERE oid = '%u'::pg_catalog.oid",
- tyinfo->dobj.catId.oid);
- }
- else if (fout->remoteVersion >= 80000)
+ else if (fout->remoteVersion >= 80400)
{
appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, typreceive, typsend, "
- "'-' AS typmodin, '-' AS typmodout, "
- "typanalyze, "
+ "typmodin, typmodout, typanalyze, "
"typreceive::pg_catalog.oid AS typreceiveoid, "
"typsend::pg_catalog.oid AS typsendoid, "
- "0 AS typmodinoid, 0 AS typmodoutoid, "
+ "typmodin::pg_catalog.oid AS typmodinoid, "
+ "typmodout::pg_catalog.oid AS typmodoutoid, "
"typanalyze::pg_catalog.oid AS typanalyzeoid, "
- "'U' AS typcategory, false AS typispreferred, "
+ "typcategory, typispreferred, "
"typdelim, typbyval, typalign, typstorage, "
"false AS typcollatable, "
- "pg_catalog.pg_get_expr(typdefaultbin, 'pg_catalog.pg_type'::pg_catalog.regclass) AS typdefaultbin, typdefault "
+ "pg_catalog.pg_get_expr(typdefaultbin, 0) AS typdefaultbin, typdefault "
"FROM pg_catalog.pg_type "
"WHERE oid = '%u'::pg_catalog.oid",
tyinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70400)
+ else if (fout->remoteVersion >= 80300)
{
+ /* Before 8.4, pg_get_expr does not allow 0 for its second arg */
appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, typreceive, typsend, "
- "'-' AS typmodin, '-' AS typmodout, "
- "'-' AS typanalyze, "
+ "typmodin, typmodout, typanalyze, "
"typreceive::pg_catalog.oid AS typreceiveoid, "
"typsend::pg_catalog.oid AS typsendoid, "
- "0 AS typmodinoid, 0 AS typmodoutoid, "
- "0 AS typanalyzeoid, "
+ "typmodin::pg_catalog.oid AS typmodinoid, "
+ "typmodout::pg_catalog.oid AS typmodoutoid, "
+ "typanalyze::pg_catalog.oid AS typanalyzeoid, "
"'U' AS typcategory, false AS typispreferred, "
"typdelim, typbyval, typalign, typstorage, "
"false AS typcollatable, "
"WHERE oid = '%u'::pg_catalog.oid",
tyinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70300)
+ else
{
appendPQExpBuffer(query, "SELECT typlen, "
- "typinput, typoutput, "
- "'-' AS typreceive, '-' AS typsend, "
+ "typinput, typoutput, typreceive, typsend, "
"'-' AS typmodin, '-' AS typmodout, "
- "'-' AS typanalyze, "
- "0 AS typreceiveoid, 0 AS typsendoid, "
+ "typanalyze, "
+ "typreceive::pg_catalog.oid AS typreceiveoid, "
+ "typsend::pg_catalog.oid AS typsendoid, "
"0 AS typmodinoid, 0 AS typmodoutoid, "
- "0 AS typanalyzeoid, "
+ "typanalyze::pg_catalog.oid AS typanalyzeoid, "
"'U' AS typcategory, false AS typispreferred, "
"typdelim, typbyval, typalign, typstorage, "
"false AS typcollatable, "
"WHERE oid = '%u'::pg_catalog.oid",
tyinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70200)
- {
- /*
- * Note: although pre-7.3 catalogs contain typreceive and typsend,
- * ignore them because they are not right.
- */
- appendPQExpBuffer(query, "SELECT typlen, "
- "typinput, typoutput, "
- "'-' AS typreceive, '-' AS typsend, "
- "'-' AS typmodin, '-' AS typmodout, "
- "'-' AS typanalyze, "
- "0 AS typreceiveoid, 0 AS typsendoid, "
- "0 AS typmodinoid, 0 AS typmodoutoid, "
- "0 AS typanalyzeoid, "
- "'U' AS typcategory, false AS typispreferred, "
- "typdelim, typbyval, typalign, typstorage, "
- "false AS typcollatable, "
- "NULL AS typdefaultbin, typdefault "
- "FROM pg_type "
- "WHERE oid = '%u'::oid",
- tyinfo->dobj.catId.oid);
- }
- else if (fout->remoteVersion >= 70100)
- {
- /*
- * Ignore pre-7.2 typdefault; the field exists but has an unusable
- * representation.
- */
- appendPQExpBuffer(query, "SELECT typlen, "
- "typinput, typoutput, "
- "'-' AS typreceive, '-' AS typsend, "
- "'-' AS typmodin, '-' AS typmodout, "
- "'-' AS typanalyze, "
- "0 AS typreceiveoid, 0 AS typsendoid, "
- "0 AS typmodinoid, 0 AS typmodoutoid, "
- "0 AS typanalyzeoid, "
- "'U' AS typcategory, false AS typispreferred, "
- "typdelim, typbyval, typalign, typstorage, "
- "false AS typcollatable, "
- "NULL AS typdefaultbin, NULL AS typdefault "
- "FROM pg_type "
- "WHERE oid = '%u'::oid",
- tyinfo->dobj.catId.oid);
- }
- else
- {
- appendPQExpBuffer(query, "SELECT typlen, "
- "typinput, typoutput, "
- "'-' AS typreceive, '-' AS typsend, "
- "'-' AS typmodin, '-' AS typmodout, "
- "'-' AS typanalyze, "
- "0 AS typreceiveoid, 0 AS typsendoid, "
- "0 AS typmodinoid, 0 AS typmodoutoid, "
- "0 AS typanalyzeoid, "
- "'U' AS typcategory, false AS typispreferred, "
- "typdelim, typbyval, typalign, "
- "'p'::char AS typstorage, "
- "false AS typcollatable, "
- "NULL AS typdefaultbin, NULL AS typdefault "
- "FROM pg_type "
- "WHERE oid = '%u'::oid",
- tyinfo->dobj.catId.oid);
- }
res = ExecuteSqlQueryForSingleRow(fout, query->data);
qtypname,
(strcmp(typlen, "-1") == 0) ? "variable" : typlen);
- if (fout->remoteVersion >= 70300)
- {
- /* regproc result is correctly quoted as of 7.3 */
- appendPQExpBuffer(q, ",\n INPUT = %s", typinput);
- appendPQExpBuffer(q, ",\n OUTPUT = %s", typoutput);
- if (OidIsValid(typreceiveoid))
- appendPQExpBuffer(q, ",\n RECEIVE = %s", typreceive);
- if (OidIsValid(typsendoid))
- appendPQExpBuffer(q, ",\n SEND = %s", typsend);
- if (OidIsValid(typmodinoid))
- appendPQExpBuffer(q, ",\n TYPMOD_IN = %s", typmodin);
- if (OidIsValid(typmodoutoid))
- appendPQExpBuffer(q, ",\n TYPMOD_OUT = %s", typmodout);
- if (OidIsValid(typanalyzeoid))
- appendPQExpBuffer(q, ",\n ANALYZE = %s", typanalyze);
- }
- else
- {
- /* regproc delivers an unquoted name before 7.3 */
- /* cannot combine these because fmtId uses static result area */
- appendPQExpBuffer(q, ",\n INPUT = %s", fmtId(typinput));
- appendPQExpBuffer(q, ",\n OUTPUT = %s", fmtId(typoutput));
- /* receive/send/typmodin/typmodout/analyze need not be printed */
- }
+ /* regproc result is sufficiently quoted already */
+ appendPQExpBuffer(q, ",\n INPUT = %s", typinput);
+ appendPQExpBuffer(q, ",\n OUTPUT = %s", typoutput);
+ if (OidIsValid(typreceiveoid))
+ appendPQExpBuffer(q, ",\n RECEIVE = %s", typreceive);
+ if (OidIsValid(typsendoid))
+ appendPQExpBuffer(q, ",\n SEND = %s", typsend);
+ if (OidIsValid(typmodinoid))
+ appendPQExpBuffer(q, ",\n TYPMOD_IN = %s", typmodin);
+ if (OidIsValid(typmodoutoid))
+ appendPQExpBuffer(q, ",\n TYPMOD_OUT = %s", typmodout);
+ if (OidIsValid(typanalyzeoid))
+ appendPQExpBuffer(q, ",\n ANALYZE = %s", typanalyze);
if (strcmp(typcollatable, "t") == 0)
appendPQExpBufferStr(q, ",\n COLLATABLE = true");
}
else
{
- /* We assume here that remoteVersion must be at least 70300 */
appendPQExpBuffer(query, "SELECT typnotnull, "
"pg_catalog.format_type(typbasetype, typtypmod) AS typdefn, "
"pg_catalog.pg_get_expr(typdefaultbin, 'pg_catalog.pg_type'::pg_catalog.regclass) AS typdefaultbin, "
else
{
/*
- * We assume here that remoteVersion must be at least 70300. Since
- * ALTER TYPE could not drop columns until 9.1, attisdropped should
- * always be false.
+ * Since ALTER TYPE could not drop columns until 9.1, attisdropped
+ * should always be false.
*/
appendPQExpBuffer(query, "SELECT a.attname, "
"pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, "
query = createPQExpBuffer();
- /* We assume here that remoteVersion must be at least 70300 */
appendPQExpBuffer(query,
"SELECT c.tableoid, a.attname, a.attnum "
"FROM pg_catalog.pg_class c, pg_catalog.pg_attribute a "
"WHERE oid = '%u'::pg_catalog.oid",
finfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 80000)
+ else
{
appendPQExpBuffer(query,
"SELECT proretset, prosrc, probin, "
"WHERE oid = '%u'::pg_catalog.oid",
finfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70300)
- {
- appendPQExpBuffer(query,
- "SELECT proretset, prosrc, probin, "
- "null AS proallargtypes, "
- "null AS proargmodes, "
- "null AS proargnames, "
- "false AS proiswindow, "
- "provolatile, proisstrict, prosecdef, "
- "false AS proleakproof, "
- "null AS proconfig, 0 AS procost, 0 AS prorows, "
- "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname "
- "FROM pg_catalog.pg_proc "
- "WHERE oid = '%u'::pg_catalog.oid",
- finfo->dobj.catId.oid);
- }
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query,
- "SELECT proretset, prosrc, probin, "
- "null AS proallargtypes, "
- "null AS proargmodes, "
- "null AS proargnames, "
- "false AS proiswindow, "
- "case when proiscachable then 'i' else 'v' end AS provolatile, "
- "proisstrict, "
- "false AS prosecdef, "
- "false AS proleakproof, "
- "null AS proconfig, 0 AS procost, 0 AS prorows, "
- "(SELECT lanname FROM pg_language WHERE oid = prolang) AS lanname "
- "FROM pg_proc "
- "WHERE oid = '%u'::oid",
- finfo->dobj.catId.oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT proretset, prosrc, probin, "
- "null AS proallargtypes, "
- "null AS proargmodes, "
- "null AS proargnames, "
- "false AS proiswindow, "
- "CASE WHEN proiscachable THEN 'i' ELSE 'v' END AS provolatile, "
- "false AS proisstrict, "
- "false AS prosecdef, "
- "false AS proleakproof, "
- "NULL AS proconfig, 0 AS procost, 0 AS prorows, "
- "(SELECT lanname FROM pg_language WHERE oid = prolang) AS lanname "
- "FROM pg_proc "
- "WHERE oid = '%u'::oid",
- finfo->dobj.catId.oid);
- }
res = ExecuteSqlQueryForSingleRow(fout, query->data);
PQExpBuffer labelq;
PQExpBuffer oprid;
PQExpBuffer details;
- const char *name;
PGresult *res;
int i_oprkind;
int i_oprcode;
"WHERE oid = '%u'::pg_catalog.oid",
oprinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70300)
+ else
{
appendPQExpBuffer(query, "SELECT oprkind, "
"oprcode::pg_catalog.regprocedure, "
"WHERE oid = '%u'::pg_catalog.oid",
oprinfo->dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query, "SELECT oprkind, oprcode, "
- "CASE WHEN oprleft = 0 THEN '-' "
- "ELSE format_type(oprleft, NULL) END AS oprleft, "
- "CASE WHEN oprright = 0 THEN '-' "
- "ELSE format_type(oprright, NULL) END AS oprright, "
- "oprcom, oprnegate, oprrest, oprjoin, "
- "(oprlsortop != 0) AS oprcanmerge, "
- "oprcanhash "
- "FROM pg_operator "
- "WHERE oid = '%u'::oid",
- oprinfo->dobj.catId.oid);
- }
- else
- {
- appendPQExpBuffer(query, "SELECT oprkind, oprcode, "
- "CASE WHEN oprleft = 0 THEN '-'::name "
- "ELSE (SELECT typname FROM pg_type WHERE oid = oprleft) END AS oprleft, "
- "CASE WHEN oprright = 0 THEN '-'::name "
- "ELSE (SELECT typname FROM pg_type WHERE oid = oprright) END AS oprright, "
- "oprcom, oprnegate, oprrest, oprjoin, "
- "(oprlsortop != 0) AS oprcanmerge, "
- "oprcanhash "
- "FROM pg_operator "
- "WHERE oid = '%u'::oid",
- oprinfo->dobj.catId.oid);
- }
res = ExecuteSqlQueryForSingleRow(fout, query->data);
if (strcmp(oprkind, "r") == 0 ||
strcmp(oprkind, "b") == 0)
{
- if (fout->remoteVersion >= 70100)
- name = oprleft;
- else
- name = fmtId(oprleft);
- appendPQExpBuffer(details, ",\n LEFTARG = %s", name);
- appendPQExpBufferStr(oprid, name);
+ appendPQExpBuffer(details, ",\n LEFTARG = %s", oprleft);
+ appendPQExpBufferStr(oprid, oprleft);
}
else
appendPQExpBufferStr(oprid, "NONE");
if (strcmp(oprkind, "l") == 0 ||
strcmp(oprkind, "b") == 0)
{
- if (fout->remoteVersion >= 70100)
- name = oprright;
- else
- name = fmtId(oprright);
- appendPQExpBuffer(details, ",\n RIGHTARG = %s", name);
- appendPQExpBuffer(oprid, ", %s)", name);
+ appendPQExpBuffer(details, ",\n RIGHTARG = %s", oprright);
+ appendPQExpBuffer(oprid, ", %s)", oprright);
}
else
appendPQExpBufferStr(oprid, ", NONE)");
* Returns allocated string of what to print, or NULL if function references
* is InvalidOid. Returned string is expected to be free'd by the caller.
*
- * In 7.3 the input is a REGPROCEDURE display; we have to strip the
- * argument-types part. In prior versions, the input is a REGPROC display.
+ * The input is a REGPROCEDURE display; we have to strip the argument-types
+ * part.
*/
static char *
convertRegProcReference(Archive *fout, const char *proc)
{
+ char *name;
+ char *paren;
+ bool inquote;
+
/* In all cases "-" means a null reference */
if (strcmp(proc, "-") == 0)
return NULL;
- if (fout->remoteVersion >= 70300)
+ name = pg_strdup(proc);
+ /* find non-double-quoted left paren */
+ inquote = false;
+ for (paren = name; *paren; paren++)
{
- char *name;
- char *paren;
- bool inquote;
-
- name = pg_strdup(proc);
- /* find non-double-quoted left paren */
- inquote = false;
- for (paren = name; *paren; paren++)
+ if (*paren == '(' && !inquote)
{
- if (*paren == '(' && !inquote)
- {
- *paren = '\0';
- break;
- }
- if (*paren == '"')
- inquote = !inquote;
+ *paren = '\0';
+ break;
}
- return name;
+ if (*paren == '"')
+ inquote = !inquote;
}
-
- /* REGPROC before 7.3 does not quote its result */
- return pg_strdup(fmtId(proc));
+ return name;
}
/*
* Returns an allocated string of what to print, or NULL to print nothing.
* Caller is responsible for free'ing result string.
*
- * In 7.3 and up the input is a REGOPERATOR display; we have to strip the
- * argument-types part, and add OPERATOR() decoration if the name is
- * schema-qualified. In older versions, the input is just a numeric OID,
- * which we search our operator list for.
+ * The input is a REGOPERATOR display; we have to strip the argument-types
+ * part, and add OPERATOR() decoration if the name is schema-qualified.
*/
static char *
convertOperatorReference(Archive *fout, const char *opr)
{
- OprInfo *oprInfo;
+ char *name;
+ char *oname;
+ char *ptr;
+ bool inquote;
+ bool sawdot;
/* In all cases "0" means a null reference */
if (strcmp(opr, "0") == 0)
return NULL;
- if (fout->remoteVersion >= 70300)
- {
- char *name;
- char *oname;
- char *ptr;
- bool inquote;
- bool sawdot;
-
- name = pg_strdup(opr);
- /* find non-double-quoted left paren, and check for non-quoted dot */
- inquote = false;
- sawdot = false;
- for (ptr = name; *ptr; ptr++)
+ name = pg_strdup(opr);
+ /* find non-double-quoted left paren, and check for non-quoted dot */
+ inquote = false;
+ sawdot = false;
+ for (ptr = name; *ptr; ptr++)
+ {
+ if (*ptr == '"')
+ inquote = !inquote;
+ else if (*ptr == '.' && !inquote)
+ sawdot = true;
+ else if (*ptr == '(' && !inquote)
{
- if (*ptr == '"')
- inquote = !inquote;
- else if (*ptr == '.' && !inquote)
- sawdot = true;
- else if (*ptr == '(' && !inquote)
- {
- *ptr = '\0';
- break;
- }
+ *ptr = '\0';
+ break;
}
- /* If not schema-qualified, don't need to add OPERATOR() */
- if (!sawdot)
- return name;
- oname = psprintf("OPERATOR(%s)", name);
- free(name);
- return oname;
- }
-
- oprInfo = findOprByOid(atooid(opr));
- if (oprInfo == NULL)
- {
- write_msg(NULL, "WARNING: could not find operator with OID %s\n",
- opr);
- return NULL;
}
- return pg_strdup(oprInfo->dobj.name);
+ /* If not schema-qualified, don't need to add OPERATOR() */
+ if (!sawdot)
+ return name;
+ oname = psprintf("OPERATOR(%s)", name);
+ free(name);
+ return oname;
}
/*
if (!opcinfo->dobj.dump || dopt->dataOnly)
return;
- /*
- * XXX currently we do not implement dumping of operator classes from
- * pre-7.3 databases. This could be done but it seems not worth the
- * trouble.
- */
- if (fout->remoteVersion < 70300)
- return;
-
query = createPQExpBuffer();
q = createPQExpBuffer();
delq = createPQExpBuffer();
appendStringLiteralAH(q, conforencoding, fout);
appendPQExpBufferStr(q, " TO ");
appendStringLiteralAH(q, contoencoding, fout);
- /* regproc is automatically quoted in 7.3 and above */
+ /* regproc output is already sufficiently quoted */
appendPQExpBuffer(q, " FROM %s;\n", conproc);
appendPQExpBuffer(labelq, "CONVERSION %s", fmtId(convinfo->dobj.name));
"AND p.oid = '%u'::pg_catalog.oid",
agginfo->aggfn.dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70300)
+ else
{
appendPQExpBuffer(query, "SELECT aggtransfn, "
"aggfinalfn, aggtranstype::pg_catalog.regtype, "
"AND p.oid = '%u'::pg_catalog.oid",
agginfo->aggfn.dobj.catId.oid);
}
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query, "SELECT aggtransfn, aggfinalfn, "
- "format_type(aggtranstype, NULL) AS aggtranstype, "
- "'-' AS aggcombinefn, '-' AS aggserialfn, "
- "'-' AS aggdeserialfn, '-' AS aggmtransfn, "
- "'-' AS aggminvtransfn, '-' AS aggmfinalfn, "
- "0 AS aggmtranstype, false AS aggfinalextra, "
- "false AS aggmfinalextra, 0 AS aggsortop, "
- "false AS hypothetical, "
- "0 AS aggtransspace, agginitval, "
- "0 AS aggmtransspace, NULL AS aggminitval, "
- "true AS convertok "
- "FROM pg_aggregate "
- "WHERE oid = '%u'::oid",
- agginfo->aggfn.dobj.catId.oid);
- }
- else
- {
- appendPQExpBuffer(query, "SELECT aggtransfn1 AS aggtransfn, "
- "aggfinalfn, "
- "(SELECT typname FROM pg_type WHERE oid = aggtranstype1) AS aggtranstype, "
- "'-' AS aggcombinefn, '-' AS aggserialfn, "
- "'-' AS aggdeserialfn, '-' AS aggmtransfn, "
- "'-' AS aggminvtransfn, '-' AS aggmfinalfn, "
- "0 AS aggmtranstype, false AS aggfinalextra, "
- "false AS aggmfinalextra, 0 AS aggsortop, "
- "false AS hypothetical, "
- "0 AS aggtransspace, agginitval1 AS agginitval, "
- "0 AS aggmtransspace, NULL AS aggminitval, "
- "(aggtransfn2 = 0 and aggtranstype2 = 0 and agginitval2 is null) AS convertok "
- "FROM pg_aggregate "
- "WHERE oid = '%u'::oid",
- agginfo->aggfn.dobj.catId.oid);
- }
res = ExecuteSqlQueryForSingleRow(fout, query->data);
return;
}
- if (fout->remoteVersion >= 70300)
- {
- /* If using 7.3's regproc or regtype, data is already quoted */
- appendPQExpBuffer(details, " SFUNC = %s,\n STYPE = %s",
- aggtransfn,
- aggtranstype);
- }
- else if (fout->remoteVersion >= 70100)
- {
- /* format_type quotes, regproc does not */
- appendPQExpBuffer(details, " SFUNC = %s,\n STYPE = %s",
- fmtId(aggtransfn),
- aggtranstype);
- }
- else
- {
- /* need quotes all around */
- appendPQExpBuffer(details, " SFUNC = %s,\n",
- fmtId(aggtransfn));
- appendPQExpBuffer(details, " STYPE = %s",
- fmtId(aggtranstype));
- }
+ /* regproc and regtype output is already sufficiently quoted */
+ appendPQExpBuffer(details, " SFUNC = %s,\n STYPE = %s",
+ aggtransfn, aggtranstype);
if (strcmp(aggtransspace, "0") != 0)
{
int len;
/* Fetch the view definition */
- if (fout->remoteVersion >= 70300)
- {
- /* Beginning in 7.3, viewname is not unique; rely on OID */
- appendPQExpBuffer(query,
+ appendPQExpBuffer(query,
"SELECT pg_catalog.pg_get_viewdef('%u'::pg_catalog.oid) AS viewdef",
- tbinfo->dobj.catId.oid);
- }
- else
- {
- appendPQExpBufferStr(query, "SELECT definition AS viewdef "
- "FROM pg_views WHERE viewname = ");
- appendStringLiteralAH(query, tbinfo->dobj.name, fout);
- }
+ tbinfo->dobj.catId.oid);
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
{
appendPQExpBufferStr(q, " WITH OPTIONS");
}
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(q, " %s",
- tbinfo->atttypnames[j]);
- }
else
{
- /* If no format_type, fake it */
appendPQExpBuffer(q, " %s",
- myFormatType(tbinfo->atttypnames[j],
- tbinfo->atttypmod[j]));
+ tbinfo->atttypnames[j]);
}
/* Add collation if not default for the type */
destroyPQExpBuffer(labelq);
}
-/*
- * findLastBuiltInOid -
- * find the last built in oid
- *
- * For 7.1 and 7.2, we do this by retrieving datlastsysoid from the
- * pg_database entry for the current database
- */
-static Oid
-findLastBuiltinOid_V71(Archive *fout, const char *dbname)
-{
- PGresult *res;
- Oid last_oid;
- PQExpBuffer query = createPQExpBuffer();
-
- resetPQExpBuffer(query);
- appendPQExpBufferStr(query, "SELECT datlastsysoid from pg_database where datname = ");
- appendStringLiteralAH(query, dbname, fout);
-
- res = ExecuteSqlQueryForSingleRow(fout, query->data);
- last_oid = atooid(PQgetvalue(res, 0, PQfnumber(res, "datlastsysoid")));
- PQclear(res);
- destroyPQExpBuffer(query);
- return last_oid;
-}
-
-/*
- * findLastBuiltInOid -
- * find the last built in oid
- *
- * For 7.0, we do this by assuming that the last thing that initdb does is to
- * create the pg_indexes view. This sucks in general, but seeing that 7.0.x
- * initdb won't be changing anymore, it'll do.
- */
-static Oid
-findLastBuiltinOid_V70(Archive *fout)
-{
- PGresult *res;
- int last_oid;
-
- res = ExecuteSqlQueryForSingleRow(fout,
- "SELECT oid FROM pg_class WHERE relname = 'pg_indexes'");
- last_oid = atooid(PQgetvalue(res, 0, PQfnumber(res, "oid")));
- PQclear(res);
- return last_oid;
-}
-
/*
* dumpSequence
* write the declaration (not data) of one user-defined sequence
{
if (OidIsValid(tginfo->tgconstrrelid))
{
- /* If we are using regclass, name is already quoted */
- if (fout->remoteVersion >= 70300)
- appendPQExpBuffer(query, " FROM %s\n ",
- tginfo->tgconstrrelname);
- else
- appendPQExpBuffer(query, " FROM %s\n ",
- fmtId(tginfo->tgconstrrelname));
+ /* regclass output is already quoted */
+ appendPQExpBuffer(query, " FROM %s\n ",
+ tginfo->tgconstrrelname);
}
if (!tginfo->tgdeferrable)
appendPQExpBufferStr(query, "NOT ");
else
appendPQExpBufferStr(query, " FOR EACH STATEMENT\n ");
- /* In 7.3, result of regproc is already quoted */
- if (fout->remoteVersion >= 70300)
- appendPQExpBuffer(query, "EXECUTE PROCEDURE %s(",
- tginfo->tgfname);
- else
- appendPQExpBuffer(query, "EXECUTE PROCEDURE %s(",
- fmtId(tginfo->tgfname));
+ /* regproc output is already sufficiently quoted */
+ appendPQExpBuffer(query, "EXECUTE PROCEDURE %s(",
+ tginfo->tgfname);
tgargs = (char *) PQunescapeBytea((unsigned char *) tginfo->tgargs,
&lentgargs);
delcmd = createPQExpBuffer();
labelq = createPQExpBuffer();
- if (fout->remoteVersion >= 70300)
- {
- appendPQExpBuffer(query,
- "SELECT pg_catalog.pg_get_ruledef('%u'::pg_catalog.oid) AS definition",
- rinfo->dobj.catId.oid);
- }
- else
- {
- /* Rule name was unique before 7.3 ... */
- appendPQExpBuffer(query,
- "SELECT pg_get_ruledef('%s') AS definition",
- rinfo->dobj.name);
- }
+ appendPQExpBuffer(query,
+ "SELECT pg_catalog.pg_get_ruledef('%u'::pg_catalog.oid) AS definition",
+ rinfo->dobj.catId.oid);
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
DumpableObject *dobj,
*refdobj;
- /* No dependency info available before 7.3 */
- if (fout->remoteVersion < 70300)
- return;
-
if (g_verbose)
write_msg(NULL, "reading dependency data\n");
/* This is checked by the callers already */
Assert(schemaName != NULL && *schemaName != '\0');
- /* Not relevant if fetching from pre-7.3 DB */
- if (fout->remoteVersion < 70300)
- return;
-
query = createPQExpBuffer();
appendPQExpBuffer(query, "SET search_path = %s",
fmtId(schemaName));
* getFormattedTypeName - retrieve a nicely-formatted type name for the
* given type name.
*
- * NB: in 7.3 and up the result may depend on the currently-selected
- * schema; this is why we don't try to cache the names.
+ * NB: the result may depend on the currently-selected search_path; this is
+ * why we don't try to cache the names.
*/
static char *
getFormattedTypeName(Archive *fout, Oid oid, OidOptions opts)
}
query = createPQExpBuffer();
- if (fout->remoteVersion >= 70300)
- {
- appendPQExpBuffer(query, "SELECT pg_catalog.format_type('%u'::pg_catalog.oid, NULL)",
- oid);
- }
- else if (fout->remoteVersion >= 70100)
- {
- appendPQExpBuffer(query, "SELECT format_type('%u'::oid, NULL)",
- oid);
- }
- else
- {
- appendPQExpBuffer(query, "SELECT typname "
- "FROM pg_type "
- "WHERE oid = '%u'::oid",
- oid);
- }
+ appendPQExpBuffer(query, "SELECT pg_catalog.format_type('%u'::pg_catalog.oid, NULL)",
+ oid);
res = ExecuteSqlQueryForSingleRow(fout, query->data);
- if (fout->remoteVersion >= 70100)
- {
- /* already quoted */
- result = pg_strdup(PQgetvalue(res, 0, 0));
- }
- else
- {
- /* may need to quote it */
- result = pg_strdup(fmtId(PQgetvalue(res, 0, 0)));
- }
+ /* result of format_type is already quoted */
+ result = pg_strdup(PQgetvalue(res, 0, 0));
PQclear(res);
destroyPQExpBuffer(query);
return result;
}
-/*
- * myFormatType --- local implementation of format_type for use with 7.0.
- */
-static char *
-myFormatType(const char *typname, int32 typmod)
-{
- char *result;
- bool isarray = false;
- PQExpBuffer buf = createPQExpBuffer();
-
- /* Handle array types */
- if (typname[0] == '_')
- {
- isarray = true;
- typname++;
- }
-
- /* Show lengths on bpchar and varchar */
- if (strcmp(typname, "bpchar") == 0)
- {
- int len = (typmod - VARHDRSZ);
-
- appendPQExpBufferStr(buf, "character");
- if (len > 1)
- appendPQExpBuffer(buf, "(%d)",
- typmod - VARHDRSZ);
- }
- else if (strcmp(typname, "varchar") == 0)
- {
- appendPQExpBufferStr(buf, "character varying");
- if (typmod != -1)
- appendPQExpBuffer(buf, "(%d)",
- typmod - VARHDRSZ);
- }
- else if (strcmp(typname, "numeric") == 0)
- {
- appendPQExpBufferStr(buf, "numeric");
- if (typmod != -1)
- {
- int32 tmp_typmod;
- int precision;
- int scale;
-
- tmp_typmod = typmod - VARHDRSZ;
- precision = (tmp_typmod >> 16) & 0xffff;
- scale = tmp_typmod & 0xffff;
- appendPQExpBuffer(buf, "(%d,%d)",
- precision, scale);
- }
- }
-
- /*
- * char is an internal single-byte data type; Let's make sure we force it
- * through with quotes. - thomas 1998-12-13
- */
- else if (strcmp(typname, "char") == 0)
- appendPQExpBufferStr(buf, "\"char\"");
- else
- appendPQExpBufferStr(buf, fmtId(typname));
-
- /* Append array qualifier for array types */
- if (isarray)
- appendPQExpBufferStr(buf, "[]");
-
- result = pg_strdup(buf->data);
- destroyPQExpBuffer(buf);
-
- return result;
-}
-
/*
* Return a column list clause for the given relation.
*