Re: Install scripts?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Charl Gerber <cpger(at)xs4all(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Install scripts?
Date: 2005-02-25 18:07:12
Message-ID: 6706.1109354832@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Charl Gerber <cpger(at)xs4all(dot)nl> writes:
> 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;

There's no IF EXISTS. Usually people just do a DROP and ignore the
error if any.

> 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" ....

You probably want to be looking at psql's \i and \c commands,
respectively. Does "insert foo" really mean a file inclusion
command in MySQL? Bizarre ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2005-02-25 18:09:39 Re: Install scripts?
Previous Message Terry Lee Tucker 2005-02-25 18:05:09 Re: Questions regarding notify processing.