Creating a new database at runtime.
am 06.02.2004 22:46:47 von Marcel WolfThis is a multi-part message in MIME format.
------=_NextPart_000_01FE_01C3ECC0.0EDDF8D0
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit
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
------=_NextPart_000_01FE_01C3ECC0.0EDDF8D0
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
0.0pt;
font-family:Arial'>Hello
0.0pt;
font-family:Arial'>I am trying to do the following:
0.0pt;
font-family:Arial'> =
1.
startup my php app
>
style=3D'font-size:10.0pt;font-family:Arial'>2. check for its database under
pgsql
>
style=3D'font-size:10.0pt;font-family:Arial'>3. If its not there it create =
it.
>
style=3D'font-size:10.0pt;font-family:Arial'>4. This may happen for several=
different
apps. I add new apps all the time.
>
style=3D'font-size:10.0pt;font-family:Arial'>
>
style=3D'font-size:10.0pt;font-family:Arial'>Attempts:
>
style=3D'font-size:10.0pt;font-family:Arial'>1.I have tried to connect to t=
he
database and check the error for absence(pg_database) and then try to creat=
e it.
This fails because the DATABASE missing is fatal.
/p>
>
style=3D'font-size:10.0pt;font-family:Arial'>2. I have tried to connect to
template1 and check pg_database for my database and if it is not there crea=
te
it.
>
style=3D'font-size:10.0pt;font-family:Arial'>
'>
>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 databa=
se.
Then I open my app to this error. When I refresh the screen everything work=
s?!
>
style=3D'font-size:10.0pt;font-family:Arial'>
>
style=3D'font-size:10.0pt;font-family:Arial'>
size=3D3
face=3D"Times New Roman">=
Warning:
pg_query(): Query failed: ERROR: relation "info_myindex_seq" alre=
ady
exists . in /usr/local/apache2/htdocs/A=
ddressBook/index.php
on line 128
Could not create info tableERROR: relation "info_myindex_seq" alr=
eady
exists
es New Roman">
style=3D'font-size:12.0pt'>
e=3D2
face=3DArial>
e=3D2
face=3DArial>3. If I rep=
eat this
sequence with a different app. It is the same performance but the new app h=
as
its tables and the tables from the first database?!
e=3D2
face=3DArial>4. I have t=
ried
turning on the sql_inheritence to false without any help.
e=3D2
face=3DArial>5. I cannot=
connect
to template0.
e=3D2
face=3DArial>
e=3D2
face=3DArial>
e=3D2
face=3DArial>
e=3D2
face=3DArial>I do not un=
derstand
the template0 concept, I am coming from the MYSQL world. Is there a way to =
do
this?????????
e=3D2
face=3DArial>
e=3D2
face=3DArial>
e=3D2
face=3DArial>Marcel
------=_NextPart_000_01FE_01C3ECC0.0EDDF8D0--