Re: Using Batch Files to Create DB Structure

From: brew(at)theMode(dot)com
To: PGSQL-Novice List <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Using Batch Files to Create DB Structure
Date: 2005-07-14 07:11:59
Message-ID: Pine.BSF.4.58.0507140304250.44370@themode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)theMode(dot)com)
Check out my Stock Option Covered Call website http://www.callpix.com
and my Musician's Online Database Exchange http://www.TheMode.com
==========================================================================

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message John J. Urbaniak 2005-07-14 15:12:59 Backups
Previous Message Kirsten Wahlstrom 2005-07-14 07:05:31 rowtypes and functions