Setup postgres with automatic table and user intitiallisation

From: "Lodron, Gerald" <Gerald(dot)Lodron(at)joanneum(dot)at>
To: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Setup postgres with automatic table and user intitiallisation
Date: 2011-06-28 09:34:11
Message-ID: E70FE8EA6EBE9241BDB4CA6D8D12E1D80144BD99BDA3@RZJC1EX.jr1.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi

I programmed an application which uses postgres 9.0. Currently i am writing an installer for my application and wrote my own GUI to set up postgres settings and i already install it ofer the original setup.exe with parameters. After that i want to create user roles and tables with psql.exe and have written 3 scripts:
-> one for creating user roles (create role statemenst bey superuser)
-> one for creating data bases (create table statements by superuser)
-> one for initializing data bases (insert statements by new role)

I have the problem that when i run my batch i always have to let the user type in the password, thats nasty... I also tried PGPASSWORD but it does not work, it always prints that it is the wrong password...

MyBatchfileOfInstallingAndInitializingPostgres.bat [Superusername] [Superuserpassword] [DataBaseOwnerName] [DatabaseownerPassword]

@echo off

%~d0
cd %~dp0
if not exist "%~dp09.0\bin\psql.exe" postgresql-9.0.4-1-windows_x64.exe --mode unattended --install_runtimes 0 --create_shortcuts 0 --prefix "%~dp09.0" --datadir "%~dp09.0\data" --serverport 5432 --serviceaccount %1 --superpassword %2 --servicepassword %2

rem set PGPASSWORD=%2
"%~dp09.0\bin\psql.exe" -U %1 -p 5432 -f CreateUser.sql
"%~dp09.0\bin\psql.exe" -U %1 -p 5432 -f CreateDatabase.sql

echo Enter ReDeformUser password to initialize ReDeformDB

rem set PGPASSWORD=%4
"%~dp09.0\bin\psql.exe" -a -d "ReDeformDB" -U %3 -p 5432 -f Inserts.sql

Thanks for any help

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Emrul Islam 2011-06-28 10:09:53 Multi-tenancy in Postgres
Previous Message fluca1978 2011-06-28 09:12:16 rationale behind quotes for camel case?