Обсуждение: pg_dump and vacuum fail on tables with no columns

Поиск
Список
Период
Сортировка

pg_dump and vacuum fail on tables with no columns

От
"Michael D. DeVore"
Дата:
It is possible to create a table with no columns:

create table mytemp ();

Not particularly useful, but students are prone do try things you wouldn't
otherwise expect. The problem is that the utility pg_dump will terminate
with an error when it encounters such a table (vacuum as well).

The error messages look like:

From pg_dump:
-------------

pg_dump: SQL command to dump the contents of table "mytemp" failed
pg_dump: Error message from server: ERROR:  parser: parse error at or near
")" at character 21
pg_dump: The command was: COPY public.mytemp () TO stdout;

From vacuumdb:
--------------

ERROR:  MemoryContextAlloc: invalid request size 0
vacuumdb: vacuum  ekv2j failed


What's more, the pg_dumpall utility will terminate as well, leaving an
entire database cluster without being backed up.

From pg_dumpall:
----------------

pg_dumpall: pg_dump failed on ekv2j, exiting

I observed these problems on PostgreSQL 7.3 on the Sun SPARC platform
running Solaris 9.

Whether or not pg_dump and pg_dumpall should terminate on an error is
debatable. However, I suggest that the errors generated by pg_dump and
vacuumdb should really be considered bugs since their failure prevents
important maintenance.

Michael
--
Michael D. DeVore                           Office: 102G Olsson Hall
Systems and Information Engineering         e-mail: _mdevore_@virginia.edu
                                                    (remove underscores)
University of Virginia                      Phone:  (434) 924-4488
151 Engineer's Way                          Fax:    (434) 982-2972
P.O. Box 400747
Charlottesville, VA 22904

Re: pg_dump and vacuum fail on tables with no columns

От
Tom Lane
Дата:
"Michael D. DeVore" <_mdevore_@virginia.edu> writes:
> It is possible to create a table with no columns:
> create table mytemp ();

Yeah, we are gradually cleaning out the places that weren't prepared to
deal with this corner case :-(.  I fixed pg_dump just a couple days ago,
but was not aware of the VACUUM ANALYZE problem --- thanks for the
report!

            regards, tom lane