Creating a new database at runtime.

From: "Marcel Wolf" <mwolfs(at)comcast(dot)net>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Creating a new database at runtime.
Date: 2004-02-06 21:46:47
Message-ID: 01fd01c3ecfa$bb3cd0d0$6401a8c0@Lightning
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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

Browse pgsql-php by date

  From Date Subject
Next Message David Cruz Ramos 2004-02-10 18:30:12 unsubscribe pgsql-php
Previous Message scott.marlowe 2004-02-04 21:18:08 Re: Problem with PHP and PostgreSQL