using drupal 6.9 and I am trying to install it using postgres as a backend

but I get the following error below when I try to install

Failed to connect to your PostgreSQL database server. PostgreSQL reports the following message: Connection failed. See log file for failure reason.

* Are you sure you have the correct username and password?
* Are you sure that you have typed the correct database hostname?
* Are you sure that the database server is running?
* Are you sure you typed the correct database name?

For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.

works when I set up mysql as the backend but not postgres any help would be greatly appreciated

thanks,

Comments

jsusanka’s picture

also I followed the instructions to a tee and I still have had no luck but only with mysql

thanks,

greg.1.anderson’s picture

In /var/lib/pgsql/data/pg_hba.conf, make sure that you have the following entries:

local all all ident sameuser
host all all 127.0.0.1/32 md5
host all all ::1/128 md5

On my CentOS distro, all three of these were 'ident sameuser' by default; changing the last two to 'md5' (and /etc/init.d/postgresql restart) allowed local connections to the database to work. However, Drupal fails on installation on the next step.

I'll post later about the problems I'm seeing; let me know if you are successful with your postgres install after fixing your connection issues.

- Greg

greg.1.anderson’s picture

After I connect to postgres 8.1.11-1 with Drupal 6.9, I get a query error during installation:

warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near ")" at character 42 in /var/www/vhosts/drupal-postgres/includes/database.pgsql.inc on line 139.
user warning: ERROR: syntax error at or near ")" at character 42 query: SELECT * FROM menu_router WHERE path IN () ORDER BY fit DESC LIMIT 1 OFFSET 0 in /var/www/vhosts/drupal-postgres/includes/menu.inc on line 315.

The contents of the () in "WHERE path IN ()" is empty; it should be formed via the expression:

implode (',', $placeholders)

It is supposed to be initialized by:

list($ancestors, $placeholders) = menu_get_ancestors($parts);

However, $placeholders is empty; this is a syntax error in both mysql and postgresql. The variable menu_masks is set to "a:6:{i:0;i:31;i:1;i:30;i:2;i:15;i:3;i:7;i:4;i:3;i:5;i:1;}" in the variable table.

My installs on mysql all worked fine. I started with a clean install of Drupal, just in case some module I had installed or cached info the mysql version stored was messing things up, but the result was the same. Anyone have any ideas?

greg.1.anderson’s picture

greg.1.anderson’s picture

The failures above were on postgres 8.1.11-1 on Centos 5; the same steps worked on Postgres 8.3 without change.

The documentation claims postgres 7.4 or later is necessary; this may need to be updated.

josh waihi’s picture

OK, Drupal 6 needs a patch. I don't have time to whip one up right now all that needs to be done is:

-- if ($router_item = db_fetch_array(db_query_range('SELECT * FROM {menu_router} WHERE path IN ('. implode (',', $placeholders) .') ORDER BY fit DESC', $a
ncestors, 0, 1))) {
++ // $placeholders cannot be empty otherwise PostgreSQL will through a syntax error.
++ if (!empty($placeholders) && $router_item = db_fetch_array(db_query_range('SELECT * FROM {menu_router} WHERE path IN ('. implode (',', $placeholders) .') ORDER BY fit DESC', $a
ncestors, 0, 1))) {
rajamca66’s picture

pls tell how to change pgsql to mysql while installaion??