Install scripts?

From: Charl Gerber <cpger(at)xs4all(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: Install scripts?
Date: 2005-02-25 17:36:18
Message-ID: 421F6212.4030608@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rookie question... I'm converting a MySQL database to Postgre. In MySQL,
all the tables are defined in seprate 'table_name.sql' file.

There is one 'install.sql' file which does something like:

DROP DATABASE db_name IF EXISTS (<--- is there something similar in
Postgre? Like the CREATE OR REPLACE FUNCTION)

CREATE DATABASE db_name;

USE db_name;

SOURCE users.sql;
SOURCE teams.sql;
SOURCE players.sql;

etc.

Using the mysql command like tool, you just run "source install.sql"
and the whole database is loaded.

How do you do this with Postgre? I tried using the "insert filename"
command, but one file cannot seem to load another (ie, a SELECT filename
gives me an error) and to start with, I cannot find something similar to
"USE DATABASE" ....

Thanks!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-02-25 17:38:35 Re: LIke and Indicies
Previous Message Si Chen 2005-02-25 17:20:29 Re: postgresql 8.0 advantages