From: | Maarten Boekhold <maartenb(at)dutepp2(dot)et(dot)tudelft(dot)nl> |
---|---|
To: | SierraAdm(at)aol(dot)com |
Cc: | pgsql-novice(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: [SQL] importing a pre sql db |
Date: | 1998-08-05 07:04:33 |
Message-ID: | Pine.SUN.3.91.980805090244.11433C-100000@dutepp2.et.tudelft.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, 4 Aug 1998 SierraAdm(at)aol(dot)com wrote:
> I have, as user postgres, created the database wc_fields via createdb.
> Now I wish to create some tables.
> The man pages - man copy - tell me how to copy values.
> How do I set up my table definitions from an external file?
> I would like to convert my existing table definition which is in the form
> database wc_fields
> file wc_members
> field wc_last_name type character length 20
> ... more such fields ...
> I can convert that to
> create table wc_members (
> wc_last_name char(20),
> ... more such ... )
> How do I get it in as the table definition?
You can put the definition in a file, and then use the psql '\i filename'
command to let psql read commands from that file. Or you could do:
cat filename | psql wc_fields
If you need passwords, use 'psql -u' and set the env variables PGUSER and
PGPASSWORD first.
Maarten
_____________________________________________________________________________
| TU Delft, The Netherlands, Faculty of Information Technology and Systems |
| Department of Electrical Engineering |
| Computer Architecture and Digital Technique section |
| M(dot)Boekhold(at)et(dot)tudelft(dot)nl |
-----------------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | James Andrews | 1998-08-05 07:38:05 | How do I get the list of table names in db |
Previous Message | Walter St. John | 1998-08-05 06:15:51 | offtopic question regarding tools. |