Creating a zero-column table - Mailing list pgsql-hackers

From Tom Lane
Subject Creating a zero-column table
Date
Msg-id 5291.1039727286@sss.pgh.pa.us
Whole thread Raw
Responses Re: Creating a zero-column table
Re: Creating a zero-column table
Re: Creating a zero-column table
List pgsql-hackers
I was bemused to notice that pg_dump is currently unable to dump the
regression database.  The domain regression test leaves an empty table
(one with zero columns), which causes pg_dump to produce

--
-- TOC entry 172 (OID 675837)
-- Name: domnotnull; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE domnotnull (
);


This is rejected on restore:

ERROR:  DefineRelation: please inherit from a relation or define an attribute

I believe that the table would be correctly restored if we simply
removed that error check in DefineRelation.  On the other hand, for
ordinary hand-entered CREATE TABLE commands it seems like a useful
error check.

Should we remove this error check, thereby effectively making
zero-column tables first-class citizens?  If not, what shall we say to
people who complain that their dump is broken?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: "value" a reserved word
Next
From: Tom Lane
Date:
Subject: Re: PQnotifies() in 7.3 broken?