From: Marcel Wolf <mwolfs@comcast.net>
To: pgsql-php@postgresql.org
Subject: Creating a new database at runtime.
Date: Fri, 6 Feb 2004 14:46:47 -0700
Message-ID: <01fd01c3ecfa$bb3cd0d0$6401a8c0@Lightning> (raw)
Hello
I am trying to do the following:
1. startup my php app
2. check for its database under pgsql
3. If its not there it create it.
4. This may happen for several different apps. I add new apps all the
time.
Attempts:
1.I have tried to connect to the database and check the error for
absence(pg_database) and then try to create it. This fails because the
DATABASE missing is fatal.
2. I have tried to connect to template1 and check pg_database for my
database and if it is not there create it.
a. This works but I get the following warning, myindex is a
serial field for my database. Do test this I go into phpPgAdmin and drop
the addressbook database. Then I open my app to this error. When I
refresh the screen everything works?!
Warning: pg_query(): Query failed: ERROR: relation "info_myindex_seq"
already exists . in /usr/local/apache2/htdocs/AddressBook/index.php on
line 128
Could not create info tableERROR: relation "info_myindex_seq" already
exists
3. If I repeat this sequence with a different app. It is the same
performance but the new app has its tables and the tables from the first
database?!
4. I have tried turning on the sql_inheritence to false without any
help.
5. I cannot connect to template0.
I do not understand the template0 concept, I am coming from the MYSQL
world. Is there a way to do this?????????
Marcel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: mwolfs@comcast.net
Subject: Re: Creating a new database at runtime.
In-Reply-To: <01fd01c3ecfa$bb3cd0d0$6401a8c0@Lightning>
References: <01fd01c3ecfa$bb3cd0d0$6401a8c0@Lightning>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox