*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.106 1999/05/13 02:35:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.107 1999/05/15 22:18:50 momjian Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "BEGIN command failed\n");
+ fprintf(stderr, "BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "isViewRule(): SELECT failed\n");
+ fprintf(stderr, "isViewRule(): SELECT failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
"Explanation from backend: '%s'.\n"
"The query was: '%s'.\n",
classname, PQerrorMessage(g_conn), query);
- if (res)
- PQclear(res);
+ PQclear(res);
exit_nicely(g_conn);
}
- if (res)
- PQclear(res);
}
}
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "dumpClasses(): command failed\n");
+ fprintf(stderr, "dumpClasses(): command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
for (tuple = 0; tuple < PQntuples(res); tuple++)
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "BEGIN command failed\n");
+ fprintf(stderr, "BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getTypes(): SELECT failed\n");
+ fprintf(stderr, "getTypes(): SELECT failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "BEGIN command failed\n");
+ fprintf(stderr, "BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getOperators(): SELECT failed\n");
+ fprintf(stderr, "getOperators(): SELECT failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "BEGIN command failed\n");
+ fprintf(stderr, "BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getAggregates(): SELECT failed\n");
+ fprintf(stderr, "getAggregates(): SELECT failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "BEGIN command failed\n");
+ fprintf(stderr, "BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getFuncs(): SELECT failed\n");
+ fprintf(stderr, "getFuncs(): SELECT failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "BEGIN command failed\n");
+ fprintf(stderr, "BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getTables(): SELECT failed\n");
+ fprintf(stderr, "getTables(): SELECT failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
if (!res2 ||
PQresultStatus(res2) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getTables(): SELECT (for inherited CHECK) failed\n");
+ fprintf(stderr, "getTables(): SELECT (for inherited CHECK) failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
ntups2 = PQntuples(res2);
if (!res2 ||
PQresultStatus(res2) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getTables(): SELECT (for CHECK) failed\n");
+ fprintf(stderr, "getTables(): SELECT (for CHECK) failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
ntups2 = PQntuples(res2);
if (!res2 ||
PQresultStatus(res2) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getTables(): SELECT (for TRIGGER) failed\n");
+ fprintf(stderr, "getTables(): SELECT (for TRIGGER) failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
ntups2 = PQntuples(res2);
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "BEGIN command failed\n");
+ fprintf(stderr, "BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getInherits(): SELECT failed\n");
+ fprintf(stderr, "getInherits(): SELECT failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getTableAttrs(): SELECT failed\n");
+ fprintf(stderr, "getTableAttrs(): SELECT failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
if (!res2 ||
PQresultStatus(res2) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getTableAttrs(): SELECT (for DEFAULT) failed\n");
+ fprintf(stderr, "getTableAttrs(): SELECT (for DEFAULT) failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
tblinfo[i].adef_expr[j] = strdup(PQgetvalue(res2, 0, PQfnumber(res2, "adsrc")));
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "BEGIN command failed\n");
+ fprintf(stderr, "BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "getIndices(): SELECT failed\n");
+ fprintf(stderr, "getIndices(): SELECT failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
}
PQclear(res);
res = PQexec(g_conn, "end");
- if (res)
- PQclear(res);
+ PQclear(res);
return indinfo;
}
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "BEGIN command failed\n");
+ fprintf(stderr, "BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "dumpProcLangs(): SELECT failed\n");
+ fprintf(stderr, "dumpProcLangs(): SELECT failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
ntups = PQntuples(res);
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "dumpOneFunc(): BEGIN command failed\n");
+ fprintf(stderr, "dumpOneFunc(): BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "dumpOneFunc(): SELECT for procedural language failed\n");
+ fprintf(stderr, "dumpOneFunc(): SELECT for procedural language failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
nlangs = PQntuples(res);
res = PQexec(g_conn, q);
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "dumpIndices(): SELECT (funcname) failed\n");
+ fprintf(stderr, "dumpIndices(): SELECT (funcname) failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
funcname = strdup(PQgetvalue(res, 0,
res = PQexec(g_conn, q);
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "dumpIndices(): SELECT (classname) failed\n");
+ fprintf(stderr, "dumpIndices(): SELECT (classname) failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
classname[nclass] = strdup(PQgetvalue(res, 0,
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "Can not create pgdump_oid table\n");
+ fprintf(stderr, "Can not create pgdump_oid table. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "Can not insert into pgdump_oid table\n");
+ fprintf(stderr, "Can not insert into pgdump_oid table. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
max_oid = atol(PQoidStatus(res));
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "Can not drop pgdump_oid table\n");
+ fprintf(stderr, "Can not drop pgdump_oid table. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (res == NULL ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "pg_dump error in finding the template1 database\n");
+ fprintf(stderr, "pg_dump error in finding the template1 database. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
ntups = PQntuples(res);
res = PQexec(g_conn, query);
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "dumpSequence(%s): SELECT failed\n", tbinfo.relname);
+ fprintf(stderr, "dumpSequence(%s): SELECT failed. Explanation from backend: '%s'.\n", tbinfo.relname, PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
- fprintf(stderr, "BEGIN command failed\n");
+ fprintf(stderr, "BEGIN command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
PQclear(res);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
- fprintf(stderr, "dumpRules(): SELECT failed for table %s\n",
- tblinfo[t].relname);
+ fprintf(stderr, "dumpRules(): SELECT failed for table %s. Explanation from backend: '%s'.\n",
+ tblinfo[t].relname, PQerrorMessage(g_conn));
exit_nicely(g_conn);
}