Minor pg_dump buglet

From: gjerde(at)icebox(dot)org
To: pgsql-hackers(at)postgresql(dot)org
Subject: Minor pg_dump buglet
Date: 1999-05-08 17:18:41
Message-ID: Pine.LNX.4.05.9905081208220.32135-100000@snowman.icebox.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Patrick Welche 1999-05-08 17:41:11 sql regress files missing
Previous Message Thomas Lockhart 1999-05-08 17:18:36 Re: [HACKERS] Help a newbie?