From: | "Peter J(dot) Schoenster" <peter(at)schoenster(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: input from a file |
Date: | 2001-05-04 00:50:28 |
Message-ID: | 3AF1A874.2551.7226A83@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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."
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew McMillan | 2001-05-04 08:07:44 | Re: [NOVICE] Re: psql with PHP question |
Previous Message | Justin Seiferth | 2001-05-03 21:53:35 | VARCHAR references |