Minor pg_dump buglet - Mailing list pgsql-hackers

From gjerde@icebox.org
Subject Minor pg_dump buglet
Date
Msg-id Pine.LNX.4.05.9905081208220.32135-100000@snowman.icebox.org
Whole thread Raw
Responses Re: [HACKERS] Minor pg_dump buglet
List 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



pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: [HACKERS] Help a newbie?
Next
From: "Patrick Welche"
Date:
Subject: sql regress files missing