Postgress errors on install

Peter.Farrow - September 28, 2008 - 18:38
Project:Subgroups for Organic groups
Version:5.x-4.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

OG Subgroups does not seem to install properly with Postgres as the database on the back end. After installation it throws the following errors:

    * warning: pg_query() [function.pg-query]: Query failed: ERROR: relation "og_ancestry" already exists in C:\cvs\realcme\drupaltest\node_development_instance3\includes\database.pgsql.inc on line 125.
    * user warning: query: CREATE TABLE og_ancestry ( gid int NOT NULL, parent int NOT NULL, PRIMARY KEY (gid, parent)); in C:\cvs\realcme\drupaltest\node_development_instance3\includes\database.pgsql.inc on line 144.
    * warning: pg_query() [function.pg-query]: Query failed: ERROR: relation "og_subgroups" does not exist in C:\cvs\realcme\drupaltest\node_development_instance3\includes\database.pgsql.inc on line 125.
    * user warning: query: CREATE INDEX og_subgroups_gid_idx ON og_subgroups (gid); in C:\cvs\realcme\drupaltest\node_development_instance3\includes\database.pgsql.inc on line 144.
    * warning: pg_query() [function.pg-query]: Query failed: ERROR: relation "og_subgroups" does not exist in C:\cvs\realcme\drupaltest\node_development_instance3\includes\database.pgsql.inc on line 125.
    * user warning: query: CREATE INDEX og_subgroups_parent_idx ON og_subgroups (parent); in C:\cvs\realcme\drupaltest\node_development_instance3\includes\database.pgsql.inc on line 144.

The following code is in og_subgroups.install:

function og_subgroups_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {og_subgroups} (
        gid int(11) NOT NULL,
        parent int(11) NOT NULL,
        PRIMARY KEY (gid, parent)
      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
    break;
    case 'pgsql':
      db_query("CREATE TABLE {og_ancestry} (
       gid int NOT NULL,
       parent int NOT NULL,
       PRIMARY KEY (gid, parent));");
      db_query("CREATE INDEX {og_subgroups}_gid_idx ON {og_subgroups} (gid);");
      db_query("CREATE INDEX {og_subgroups}_parent_idx ON {og_subgroups} (parent);");
      break;
  }
}

For Postgres, is there a reason that table og_ancestry is being created rather than table og_subgroups? (With OG 5.x-7.3 og_ancestry already exists and it creates a conflict.) Also, are the two indexes {og_subgroups}_gid_idx and {og_subgroups}_parent_idx needed since gid and parent are already designated as primary keys?

Thanks

#1

ezra-g - September 28, 2008 - 18:48
Title:Installing OG Subgroups using Postgres» Postgress errors on install
Category:support request» bug report

Thanks for this report!

The postgres part of the install file needs some revision.

#2

ezra-g - September 28, 2008 - 18:48
Priority:critical» normal

#3

ezra-g - September 28, 2008 - 18:48
Priority:normal» critical

#4

Peter.Farrow - September 28, 2008 - 21:27

This code seems to work with similar changes made to function og_subgroups_update_1()

case 'pgsql':
      db_query("CREATE TABLE {og_subgroups} (
       gid int NOT NULL,
       parent int NOT NULL,
       PRIMARY KEY (gid, parent)
   );");
      break;

#5

Amitaibu - September 29, 2008 - 06:43

Thanks, i'll have time to fix it in a few days. (unless ezra you wanna do it, looks like changing og_ancestry with og_subgroups

#6

Amitaibu - September 30, 2008 - 12:40
Version:5.x-4.0» 5.x-4.x-dev
Priority:critical» normal
Status:active» fixed

I had a look, this issue is *already solved* in the 5.x4-.x version.

#7

Anonymous (not verified) - October 14, 2008 - 12:41
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.