Re: Using Batch Files to Create DB Structure - Mailing list pgsql-novice

From brew@theMode.com
Subject Re: Using Batch Files to Create DB Structure
Date
Msg-id Pine.BSF.4.58.0507140304250.44370@themode.com
Whole thread Raw
In response to Using Batch Files to Create DB Structure  (Don Parris <gnumathetes@gmail.com>)
List pgsql-novice
Don....

> In MySQL, I could use a simple batch file to run all my table creation
> statements:
> mysql -u user -p mydb < /file/path/batchfile.sql
>
> Is this possible with PGSQL?  Can I do this, for instance:
> psql -W mydb < /file/path/batchfile.sql
>
> and get all my tables created?

Yes.

I always have to play with it to get the command line right.  And then
when loading a mysql dump into postgreSQL I have to play with it
some more.

What works best for me is to put drop table statements in at the begining
of the dump, then I keep loading it in over and over, each time
noting the errors and correcting the definitions until I get the table
defined and the data loaded.

The data types are slightly different mostly.

There is a script to go from mysql to postgreSQL somewhere, but I've never
used it.  Always did it by hand.

brew

 ==========================================================================
                  Strange Brew   (brew@theMode.com)
  Check out my Stock Option Covered Call website  http://www.callpix.com
     and my Musician's Online Database Exchange http://www.TheMode.com
 ==========================================================================


pgsql-novice by date:

Previous
From: Don Parris
Date:
Subject: Using Batch Files to Create DB Structure
Next
From: "John J. Urbaniak"
Date:
Subject: Backups