I am trying to install Drupal 7.2 using postgresql 9.04 and use a specific schema I have created within my postgresql database. See below for the postgresql documentation that came with Drupal 7.2 that confirms this is supported. The documentation below instructs me to set the db_prefix within the settings.php file for this to work which I have done, Here is what I have $db_prefix = 'drupal.';. I have tried it with and without the "." suffix and drupal still installs in the public schema. Will someone please tell me the trick I am missing, this is very frustrating. Thanks for any help!!
The INSTALL.pgsql.txt for postgresql says the following:
Drupal will run across different schemas within your database if you so wish. By default, Drupal runs inside the 'public' schema but you can use $db_prefix inside settings.php to define a schema for Drupal to run inside of, or specify tables that are shared inside of a separate schema.
Comments
Postgresql, db_prefix, Drupal 7.2
Hi dazy,
Once you've created the database, you may have created also a new role (say, 'user1') to access the newly created db.
If you now wanna install drupal on a new separate schema, thy the following sql script:
-- Create the new 'drupal' role
CREATE ROLE drupal LOGIN ENCRYPTED PASSWORD 'drupalpwd' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE;
COMMENT ON ROLE drupal IS 'Drupal test';
-- Chreate the postgresql schema where you wan to confine all drupal database objects
CREATE SCHEMA drupal AUTHORIZATION drupal;
COMMENT ON SCHEMA drupal IS 'This schema is to confine Drupal objects into a separate schema';
-- grant some priviledges to user 'drupal' to its own schema
GRANT ALL PRIVILEGES ON SCHEMA drupal TO drupal;
Right after the above you need to add the following line to the file '.htaccess' in the drupal root distribution
php_value auto_append_file none
Then add the following line to the file sites/default/default.settings.php (relative to drupal root distribution)
$db_prefix = 'drupal';
Finally you can start navigating through the install pages of drupal.
WARNING !!!
Do not forget to set up drupal database information as the following example
[SETUP DATABASE]
Database Type : postgresql
Database Name : The name of your existing Database (not the schema!)
Database Username : The newly created Drupal Role (typically: 'drupal')
Database Password : The newly created Drupal Role password.
[ADVANCED OPTIONS]
Database Host : Usually 'localhost'
Database Port : Usually 5432
Table Prefix : 'drupal_' (can be usefull to identify drupal objects)
Good luck
Rgds
Postgresql and non-default schema
I found that, even with addition of $db_prefix, my Drupal 7.12 and PostgreSQl 9.1 installation failed in the manner described in this "Multiple Issues" thread:
http://drupal.org/node/1060476
Specifically, I only got installation to complete by making the change in post #17 -- changing "public." to "myschemaname." in /includes/database/pgsql/schema.inc.
If this problem has been systematically fixed in core, I can't find it. It's likely to cost others a few hours and 5-6 D7 installs :)
Jim