Re: Does this table exist?
| От | Tom Lane |
|---|---|
| Тема | Re: Does this table exist? |
| Дата | |
| Msg-id | 26999.973201222@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Does this table exist? (Alvaro Herrera <alvherre@protecne.cl>) |
| Список | 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 по дате отправления: