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 |
Jump to:
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
Thanks for this report!
The postgres part of the install file needs some revision.
#2
#3
#4
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
Thanks, i'll have time to fix it in a few days. (unless ezra you wanna do it, looks like changing
og_ancestrywithog_subgroups#6
I had a look, this issue is *already solved* in the 5.x4-.x version.
#7
Automatically closed -- issue fixed for two weeks with no activity.