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


Sat, 8 May 1999 12:18:41 -0500 (CDT)
gjerde@icebox.org
Minor pg_dump buglet
Sure, can you send us a patch:


> 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
> 
> 
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Mon, 10 May 1999 14:20:19 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Minor pg_dump buglet