pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
importing a pre sql db
3+ messages / 3 participants
[nested] [flat]

* importing a pre sql db
@ 1998-08-04 21:38  SierraAdm@aol.com
  0 siblings, 2 replies; 3+ messages in thread

From: SierraAdm@aol.com @ 1998-08-04 21:38 UTC (permalink / raw)
  To: pgsql-novice@postgresql.org; +Cc: pgsql-sql

  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?
  After that I can edit existing data and use the copy from command .
  Now is this a novice question or an sql question -
  that is why I posted in two places.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] importing a pre sql db
@ 1998-08-05 05:15  Leslie Mikesell <les@Mcs.Net>
  parent: SierraAdm@aol.com
  1 sibling, 0 replies; 3+ messages in thread

From: Leslie Mikesell @ 1998-08-05 05:15 UTC (permalink / raw)
  To: SierraAdm@aol.com; +Cc: pgsql-novice@postgresql.org; pgsql-sql

According to SierraAdm@aol.com:
>   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 type it directly into psql (don't forget the terminating ';')
but I usually put all the table definitions, sequences, indexes
and grant statements in a file and use the '\i file' command from
psql to execute them.

  Les Mikesell
    les@mcs.com



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] importing a pre sql db
@ 1998-08-05 07:04  Maarten Boekhold <maartenb@dutepp2.et.tudelft.nl>
  parent: SierraAdm@aol.com
  1 sibling, 0 replies; 3+ messages in thread

From: Maarten Boekhold @ 1998-08-05 07:04 UTC (permalink / raw)
  To: SierraAdm@aol.com; +Cc: pgsql-novice@postgresql.org; pgsql-sql

On Tue, 4 Aug 1998 SierraAdm@aol.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.Boekhold@et.tudelft.nl                         |
-----------------------------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~1998-08-05 07:04 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-08-04 21:38 importing a pre sql db SierraAdm@aol.com
1998-08-05 05:15 ` Leslie Mikesell <les@Mcs.Net>
1998-08-05 07:04 ` Maarten Boekhold <maartenb@dutepp2.et.tudelft.nl>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox