I have an install script that can create a db, with
(sql ddl)create database if not exist
.
Since Postgres works differently the script doesn't work.
So I build a special case for Postgres and used the
(commandline) createdb -U ...
command for generating a database.
It works so far, but Postgres requests the password a second time.
Following this thread i found out that
I can provide the password with the var PGPASSWORD
Following this thread i came up with a solution:
(php)
exec(' set PGPASSWORD=$password && createdb -U "$username" -h "$host" "$dbname" ')
(simplified escapes)
but this returns an error:
createdb: could not connect with template1: FATAL: Password authentication for user »postgres« failed (translated)
I am not familiar with commandline and its characteristics ->
I am not sure if I did a grave unnoticed misstake there, i am sorry if i did
I will implement now a version where Postgres asks the user a second time,
but it would be cool if you find a solution where the user doesn't have to type password twice