FAQ
Greetings,

I'm coming over from MySQL. I'm running SUSE Linux 9.2, running PGSQL 7.4.8.

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?

Or is this why there are a dozen languages for server programming? If
redirecting the input from a batchfile is possible, please point me to
the right documentation.. If not, I'll go back to the languages
section of the manual. Many thanks in advance.

Don
--
DC Parris GNU Evangelist
http://matheteuo.org/
gnumathetes@gmail.com
Free software is like God's love -
you can share it with anyone anywhere anytime!

Search Discussions

  • Brew at Jul 14, 2005 at 7:12 am
    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
    ==========================================================================
  • John DeSoi at Jul 15, 2005 at 5:30 am

    On Jul 14, 2005, at 1:55 AM, Don Parris wrote:

    Is this possible with PGSQL? Can I do this, for instance:
    psql -W mydb < /file/path/batchfile.sql

    and get all my tables created?

    Or is this why there are a dozen languages for server programming? If
    redirecting the input from a batchfile is possible, please point me to
    the right documentation.. If not, I'll go back to the languages
    section of the manual. Many thanks in advance.
    Yes, PostgreSQL has command line tool like mysql. The manual location
    is:

    http://www.postgresql.org/docs/8.0/interactive/app-psql.html


    John DeSoi, Ph.D.
    http://pgedit.com/
    Power Tools for PostgreSQL

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedJul 14, '05 at 5:55a
activeJul 15, '05 at 5:30a
posts3
users3
websitepostgresql.org
irc#postgresql

3 users in discussion

John DeSoi: 1 post Brew: 1 post Don Parris: 1 post

People

Translate

site design / logo © 2022 Grokbase