Re: input from a file

Поиск
Список
Период
Сортировка
От Peter J. Schoenster
Тема Re: input from a file
Дата
Msg-id 3AF1A874.2551.7226A83@localhost
обсуждение исходный текст
Ответ на input from a file  ("Stephen M. Ford" <sford@Eng.Auburn.EDU>)
Список pgsql-novice
> I have a dump from a msql database into a file and would like postgre
> to build the tables and insert the data into those tables.  How do I
> go about getting postgre to read commands from a file?

Here is a simple example (the following is in a file I would call
career_positions.psql) :

CREATE TABLE "career_positions" (
"cpid" smallint,
"f_ecid" smallint REFERENCES employment_categories (ecid),
"career_positions_name" character varying(60),
"orderby" smallint
);

COPY "career_positions"  FROM stdin;
32    8    Accountant and Auditor    32
33    8    Advertising/Marketing    33
596    20    Writers and Authors     596
\.

create index cpid_index on career_positions (cpid);
create index cp_name_index on career_positions
(career_positions_name);

_end file

and then just

psql database < career_positions.psql


Peter
datapanik  - Toronto Canada
"The user interface should be a clear and simple path through
information and tasks, not a series of gates and doors."

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

Предыдущее
От: Patrice Espié
Дата:
Сообщение: Re: SELECT performance problem on a join
Следующее
От: Knut Suebert
Дата:
Сообщение: unique (a,b)?