Re: Building a database from a flat file

Поиск
Список
Период
Сортировка
От Markus Schaber
Тема Re: Building a database from a flat file
Дата
Msg-id 42275B20.6030108@logix-tt.com
обсуждение исходный текст
Ответ на Re: Building a database from a flat file  ("Casey T. Deccio" <ctdecci@sandia.gov>)
Список pgsql-sql
Hi, Casey,

Casey T. Deccio schrieb:

> Question: is there an "easy" way to duplicate an existing schema
> (tables, functions, sequences, etc.)--not the data; only the schema?
> This way, I would only need to modify one schema (public) to make
> changes, and the build schema could be created each time as a duplicate
> of the public schema.  Maintenance would be much simpler.

I do not know about schemas, but for tables you can "CREATE TABLE alpha
(LIKE beta)".

>>- Create the new data in differently named tables, and then simply
>>rename all the old and new tables for "switch over".
> This probably would work too, but there may be problems with foreign
> keys in renaming the tables one at a time (unless deferrable is used).
> To avoid any mess, the previous one works well.

AFAIK, the foreign key relations are adopted when a table is renamed,
they stick to the same table disregarding name changes.


Markus
-- 
Markus Schaber | Dipl. Informatiker | Software Development GIS

Fight against software patents in EU! http://ffii.org/
http://nosoftwarepatents.org/


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

Предыдущее
От: "Casey T. Deccio"
Дата:
Сообщение: Re: Building a database from a flat file
Следующее
От: Bricklen Anderson
Дата:
Сообщение: Re: Building a database from a flat file