Forum OpenACS Q&A: Re: xowiki install failed in new OpenACS install

Posted by Gustaf Neumann on
Dear Colin,

the postgres version is not the problem. The problem seems to be that in your installation, xowiki adds the column "title" to xowiki_page, leading later to duplicate columns.

[07/Jul/2015:11:55:18][48366.7fc22953f700][-conn:openacs:0-] Notice: xodb: adding column <alter table xowiki_page add column description  text >
[07/Jul/2015:11:55:18][48366.7fc22953f700][-conn:openacs:0-] Notice: xodb: adding column <alter table xowiki_page add column publish_date  timestamp with time zone >
[07/Jul/2015:11:55:18][48366.7fc22953f700][-conn:openacs:0-] Notice: xodb: adding column <alter table xowiki_page add column title  varchar(1000) >

When one adds the following line

--- xotcl-core/tcl/05-db-procs.tcl	30 Jun 2015 09:20:54 -0000	1.102
+++ xotcl-core/tcl/05-db-procs.tcl	9 Jul 2015 15:10:16 -0000
@@ -706,6 +706,7 @@
   require proc table {name definition {populate ""}} {
+    my log "==== require table $name exists: [my exists_table $name]\n$definition"
     if {![my exists_table $name]} {
       set lines {}
       foreach col [dict keys $definition] {lappend lines "$col [dict get $definition $col]"}

one should see at startup
[09/Jul/2015:10:12:07][83047.7fff7bd72300][-main-] Notice: ==== require table xowiki_page exists: 1
page_order { ltree DEFAULT '' } creator { text } page_id { integer REFERENCES cr_revisions(revision_id) ON DELETE CASCADE
        CONSTRAINT xowiki_page_page_id_pk PRIMARY KEY }, ::xo::db::require ->table (0ms, 11ms)
The values are pairs with attribute_names and definitions. Probably, on your site you get "text", "publish_date" and "title" as well.... but why?

hmm... i found something incorrect: a cached value might lead to incorrect results, returning "title" in the table definition - but that should not happen during installs/loading. Do you have some local modification affecting the loading order?

Please try the change below, it should work with oacs-5-8 and the HEAD version. AFIKT, thus change causes no harm. Currently, i am on the move in Mexico (vacation), but i will commit this when possible.

best regards

--- xotcl-core/tcl/01-debug-procs.tcl	15 Jun 2015 19:28:33 -0000	1.76
+++ xotcl-core/tcl/01-debug-procs.tcl	9 Jul 2015 16:08:54 -0000
@@ -967,7 +967,8 @@
   set newSlot [self]::slot::$name
   $slot copy $newSlot
-  $newSlot configure -domain [self] -manager $newSlot -create_acs_attribute false {*}$config
+  $newSlot configure -domain [self] -manager $newSlot -create_acs_attribute false -create_table_attribute false {*}$config
+  my set db_slot($name) $newSlot 
Posted by Colin Charbonneau on
I attempted the change at the bottom of your post, but it did not seem to be the cause of my problems. I am doing to drop the DB and re-install again, and try the extra log entry to see what I receive from it.
Posted by Colin Charbonneau on
Adding this log message did not seem to make any significant impact on startup... it does not seem to be getting reached.
Posted by Gustaf Neumann on
the code leading to the problem checks, if the table has the desired columns, and adds if it these are not there. So, when your database has already the columns "description", "publish_date" and "title" defined for table "xowiki_page", then the problem persists.

If it is a fresh db, i would recommend to drop the db and install new. Otherwise, drop the mentioned columns from "xowiki_page", do a "drop view xowiki_pagei CASCADE" and restart. With the mentioned changes, xowiki will heal itself.

This code in "require table" will be definitely executed, since this is the only place where "alter table ... add column" is executed (as shown from your install error.log). Can it be that you have multiple xotcl-core* directories under packages and you have modified the wrong instance?

I've added the mentioned change to cvs HEAD an to the oacs-5-8 branch. After the next generation of the APM files this night (middle-european time) the change is as well in the .apm file in the OpenACS repository.


Posted by Colin Charbonneau on
You're right. OpenACS was loading the wrong code after I'd made the change. This seems to work now.

Thanks for your help, especially while on vacation.

Posted by Gustaf Neumann on
Glad, that it helped! -g