Forum OpenACS Development: XoWiki and cr_text???

Request notifications

Posted by Frank Bergmann on

We have finally found the XoWiki issue that we had in ]po[, probably due to strange update issues or whatever.

Basically, the view "xowiki_formi" references a table "cr_text" that had two entries in our database. We could fix our issue by deleting one of the two entries:

# select oid, * from cr_text;
oid | text_data
42300926 |
42300927 |
(2 rows)

But I don't understand the function of cr_text in this "xowiki_formi" view. There is no where condition for cr_text. Does this really make sense?:

SELECT  [...]
cr_text.text_data AS text,
FROM acs_objects,
cr_revisions cr,
WHERE acs_objects.object_id = cr.revision_id AND
acs_objects.object_id = xowiki_form.xowiki_form_id AND
acs_objects.object_id = xowiki_page_template.page_template_id AND
acs_objects.object_id = xowiki_page.page_id;


2: Re: XoWiki and cr_text??? (response to 1)
Posted by Gustaf Neumann on

You are most likely refering to the problem reported by Klaus Hofeditz.

The SOMENAME_i and SOMENAME_x views are generated automatically from OpenACS. The logic concerning cr_text is not specific to xowiki (see e.g. cr_revisionsi). I have never seen anyone be able to insert to this table; can it be that there are some changes in the datamodel of PO?

Below are the standard definitions of cr_text that show that the database prohibits all inserts to this table.

All the best
Gustaf Neumann

oacs=# \d cr_text
    Table "public.cr_text"
  Column   | Type | Modifiers 
 text_data | text | 
    cr_text_tr BEFORE INSERT ON cr_text FOR EACH ROW EXECUTE PROCEDURE cr_text_tr()

oacs=# \df++ cr_text_tr
List of functions
-[ RECORD 1 ]-------+--------------------------------------------------------------------
Schema              | public
Name                | cr_text_tr
Result data type    | trigger
Argument data types | 
Type                | trigger
Volatility          | volatile
Owner               | nsadmin
Language            | plpgsql
Source code         | 
                    : begin
                    :    raise EXCEPTION '-20000: Inserts are not allowed into cr_text.';
                    :    return new;
                    : end;
Description         | 

3: Re: XoWiki and cr_text??? (response to 1)
Posted by Frank Bergmann on
Hi Gustaf,

> reported by Klaus Hofeditz.

Right, that was the issue.

> cr_text

I have no idea how PostgreSQL could ever allow a second column in this table. Maybe that's because the data in our database really were generated by ACS 3.4 at some moment and everything else are upgrades.

> generated automatically from OpenAcs

Yeah, I've seen this, and so my question about the sense of cr_text was more targeted at the wizards behind the CR. I'm sure there is or was some good reason to include this table at some time...