Re: Creating a zero-column table

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: Creating a zero-column table
Дата
Msg-id 1039728060.1950.8.camel@rh72.home.ee
обсуждение исходный текст
Ответ на Creating a zero-column table  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane kirjutas R, 13.12.2002 kell 02:08:
> 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? 

I would vote for removing the check. I see no reason why one should not
be able to define a zero-column table. While we cant currently do
anything useful (except select oid :) with it now, it does not mean that
it would not serve as a valid base table for inheritance hierarchies in
future. 

I'm probably going to propose an implicit zero-column base table for all
user defined tables (say any_table) so that one can get a list of all
tuple ids in all tables by doing a simple 
"select tableoid,oid from any_table". This will of course not be very
useful for tables with no oids and where there is no index on oid.


-- 
Hannu Krosing <hannu@tm.ee>


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: PQnotifies() in 7.3 broken?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: PQnotifies() in 7.3 broken?