Forum OpenACS Q&A: xowiki V0.118 - exception NSINT, Query returned more than one row

I run into the following issue having installed xowiki on acs-kernel 5.4.0:

I was able to see /xowiki/index exactly once. All additional requests to either /xowiki/index or xowiki/admin/ would result in the following error:

Database operation "0or1row" failed
(exception NSINT, "Query returned more than one row.")
(Status of PQexec call: none; PQexec returned null pointer)
SQL: select n.object_type,o.creation_user,o.creation_date,i.publish_status,n.last_modified,o.package_id,n.page_order,n.creator,n.ppage_id,n.page_id,n.object_id,n.description,n.xowiki_object_id,n.data AS text,n.title,n.nls_language,i.name,n.mime_type,n.title,n.revision_id,n.item_id,n.publish_date,n.creation_user as modifying_user, i.parent_id from xowiki_objecti n, cr_items i, acs_objects o where i.item_id = 617212 and n.xowiki_object_id = coalesce(i.live_revision, i.latest_revision) and o.object_id = i.item_id

while executing
"ns_pg_bind 0or1row nsdb0 { select n.object_type,o.creation_user,o.creation_date,i.publish_status,n.last_modified,o.package_id,n.page_order,n.creator,n..."
("uplevel" body line 1)
invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
("postgresql" arm line 2)
invoked from within

View 'xowiki_objecti' returns two identical records. Any clues where to start diggin'?

Thanks in advance
Klaus

This problem is due to the fact that your installation most likely has two entries in "cr_text". It should be only one (or so I presume from the rest of OpenACS code).

I don't know why cr_text exists and how you could have ended up with two rows in your code. I can tell that cr_text does not allow inserts (there is a trigger) so my assumption is, that it really only exists with one row which is empty (or could be updated).

OCT, could some of you please verify that my assumption about cr_text is correct?

in your installation you can execute the following commands:

select * from cr_text (make sure it shows more than one row, otherwise the problem lies somewhere else)

alter table cr_text disable trigger cr_text_tr;
delete from cr_text;
insert into cr_text (text_data) values ('');
alter table cr_text enable trigger cr_text_tr;

Hi Malte,

confirmed - table cr_text had two records. Deleting them and creating a new one, resolved the problem.

Until we we haven't figured out the cause, the following patch might contribute to a more stable environment:

**********************************************

[projop@project-open-v34 tcl]$ cvs diff cr-procs.tcl
Index: cr-procs.tcl
===================================================================
RCS file: /cvsroot/openacs-4/packages/xotcl-core/tcl/cr-procs.tcl,v
retrieving revision 1.44
diff -r1.44 cr-procs.tcl
469c469,470
< and o.object_id = i.item_id"
---

and o.object_id = i.item_id
limit 1"

**********************************************

Thanks again!
Klaus