Minor pg_dump buglet
Ole Gjerde <gjerde@icebox.org>
From: gjerde@icebox.org
To: pgsql-hackers@postgresql.org
Date: 1999-05-08T17:18:41Z
Lists: pgsql-hackers
Hey,
Found a little "bug" in pg_dump today.
[snip]
-- finding the attribute names and types for each table
-- finding the attrs and types for table: 'members'
-- finding the attrs and types for table: 'currentuser'
-- finding DEFAULT expression for attr: 'id'
-- finding the attrs and types for table: 'memberaccess'
-- finding DEFAULT expression for attr: 'id'
-- flagging inherited attributes in subtables
-- dumping out user-defined types
-- dumping out tables
-- dumping out user-defined procedural languages
-- dumping out user-defined functions
-- dumping out user-defined aggregates
-- dumping out user-defined operators
-- dumping out the contents of all of 5 tables
-- dumping out the contents of Table 'members'
-- dumping out the contents of Table 'currentuser'
-- dumping out the contents of Table 'memberaccess'
| postgres | currentuser | table |
| postgres | currentuser_id_seq | sequence |
| postgres | memberaccess | table |
| postgres | memberaccess_id_seq | sequence |
| postgres | members | table |
As you can see, it says it's dumping out 5 tables, while there is only 3
real tables. I guess it's also counting the 2 sequences as tables(or
tuples in this case). This might be right(sequences being tuples), but in
this case they should in my opinion not be counted..
Also, in getTables() in pg_dump.c there are at least a couple of these:
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
fprintf(stderr, "BEGIN command failed\n");
exit_nicely(g_conn);
}
Shouldn't this be more like
if (!res ||
PQresultStatus(res) != PGRES_COMMAND_OK)
{
fprintf(stderr, "BEGIN command failed(%s)\n", PGresultErrorMessage(res));
exit_nicely(g_conn);
}
or
if (!res)
{
fprintf(stderr, "BEGIN command failed\n");
exit_nicely(g_conn);
} else if(PGresultStatus(res) != PGRES_COMMAND_OK) {
fprintf(stderr, "BEGIN command failed. ERROR: %s\n", PGresultErrorMessage(res));
exit_nicely(g_conn);
}
Thanks,
Ole Gjerde