e postgres user.
Thanks
Bruce
_
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ashish Karalkar
Sent: 09 February 2007 07:54
To: pgsql-general@postgresql.org
Cc: Shoaib Mir
Subject: [GENERAL] Automating databse creation
Hello list,
I want to automate database creation
Hi,
On Friday 09 February 2007 08:53, Ashish Karalkar wrote:
| I want to automate database creation, user creation,table creation via
| script. this script will be run by an external programme to postgresql
| server. is there any way?
|
| what i want to do is as follows:
|
|
| #!/bin/sh
|
| su - p
Hello list,
I want to automate database creation, user creation,table creation via script.
this script will be run by an external programme to postgresql server.
is there any way?
what i want to do is as follows:
#!/bin/sh
su - postgres
TIMEDUMP=`date +%Y%m%d"_"%H%M`
PG_PATH=/usr/local/pgsql
Yes, you can pass values to the scripts. Here is an example
Suppose the script file 'test.sql' is like this:
insert into test values (:chk1 , :chk2);
Now you can pass the variables using psql as:
psql -d test -U postgres -v chk1=5 -v chk2='abc' -f test.sql
Hope that helps...
--
Shoaib Mi