Re: Does this table exist? - Mailing list pgsql-general

From Tom Lane
Subject Re: Does this table exist?
Date
Msg-id 26999.973201222@sss.pgh.pa.us
Whole thread Raw
In response to Does this table exist?  (Alvaro Herrera <alvherre@protecne.cl>)
List pgsql-general
Alvaro Herrera <alvherre@protecne.cl> writes:
> Now, the question is: Is there a way to know if a given table exist?

Several people pointed out that you can easily do that by fishing around
in the system catalogs, but that seems like a bad solution to me.  How
will you distinguish the tables that correspond to customers from the
other tables that are hanging around your database?

Seems like a better approach is to make an additional table that lists
all the customers and the names of their dedicated tables.  I won't
argue with you about whether you really need a dedicated table for the
bulky per-customer info, but surely there are a lot of smaller per-
customer items --- name, address, phone, that sort of thing --- that
are most reasonably kept in a master table.  Just add a column for the
name of the bulky table.

Also, you might want to think about making all these per-customer tables
be inheritance children of a single prototype table.

            regards, tom lane

pgsql-general by date:

Previous
From: KuroiNeko
Date:
Subject: Re: Does this table exist?
Next
From: The Hermit Hacker
Date:
Subject: Re: the List! the List