From: | "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | "Prashant Sinha" <prashant(at)envivio(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Need Help in creating script |
Date: | 2001-05-17 22:05:14 |
Message-ID: | 200105172205.f4HM5EAJ015058@linda.lfix.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
"Prashant Sinha" wrote:
>I am a new postgre user. I had used sql commands to create database and tab=
>les. Is it possible to create a script or installable version on existing d=
>atabase which I could run on any machine and it would crearte the database =
>with all the tables and everything. Can anyone please help me with this?
>Thanks in advance,
A simple example:
Put the database commands in a text file (precede comments with --):
CREATE DATABASE junk;
\connect junk
-- Table "a" is adgaga axdfaxdfga hgfadsh
CREATE TABLE a (f1 INT PRIMARY KEY,
f2 TEXT);
...and so on...
Then run the script:
$ psql <sql.script
(Obviously you need to be a database user with the privilege to let you
do everything that is in the script.)
(I see you are using Microsoft mail software. The above commands are for
Unix; I don't know whether they need any modification for Windows.)
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Jesus said unto her, I am the resurrection, and the
life. He that believeth in me, though he were dead,
yet shall he live." John 11:25
From | Date | Subject | |
---|---|---|---|
Next Message | Muhammed Yazici | 2001-05-18 13:45:33 | createdb -D /other/path dbname does not work |
Previous Message | Shaun Thomas | 2001-05-17 20:57:29 | Cost limit. |