Forum OpenACS Development: Problem with acs_rels

Collapse
Posted by Jose Pablo Escobedo Del Cid on
Hi everyone,

I'm having problems using the acs_rels. This is what is going on:

1. I create the rel_type like this:
rel_types::new rel_name "name" "pretty name" \
object_type_one 0 {} \
object_type_two 0 {}

2. When I want to create a relation (using the tcl function relation_add), I get a warning message like this:
Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
ERROR: function acs_rel__new() does not exist

3. The called function is rel_name_rel__new, and it is an auto-generated function:

create function rel_name_rel__new(int4,varchar,timestamptz,varchar,timestamptz,varchar,int4,int4) returns int4 as '
1 declare
2 p_REL_ID alias for $1;
3 p_OBJECT_TYPE alias for $2;
4 p_CREATION_DATE alias for $3;
5 p_CREATION_IP alias for $4;
6 p_LAST_MODIFIED alias for $5;
7 p_MODIFYING_IP alias for $6;
8 p_CREATION_USER alias for $7;
9 p_CONTEXT_ID alias for $8;
10 v_rel_id rel_name_rel_ext.rel_id%TYPE;
11 begin
12
13 v_rel_id := acs_rel__new (
14
15 );
16
17 insert into rel_name_rel_ext
18 (rel_id)
19 values
20 (v_rel_id);
21
22 return v_rel_id;
23
24 end;' language 'plpgsql';

The error is in the call to the acs_rel__new function in this auto-generated function, but I haven't found where is this function created.

Can someone tell me where/how is this function created in order to fix it?

Thanks.

jopez

Collapse
2: Re: Problem with acs_rels (response to 1)
Posted by Malte Sussdorff on
Yeah... well...

Look at the package_create_* procs and somewhere there you will find bits and pieces that acutally create the rel_name_rel__new functions.

Collapse
Posted by Jose Pablo Escobedo Del Cid on
It was because of a missing line in the acs-kernel/sql/postgresql/acs-relationships-create.sql file, this is the missing line:

select define_function_args('acs_rel__new','rel_id,rel_type,object_id_one,object_id_two,context_id,creation_user,creation_ip');

That's why the call to acs_rel_new in the "auto-generated" function was wrong. I tried this and it is working fine now. This was fixed in HEAD.

jopez

Collapse
4: Re: Problem with acs_rels (response to 1)
Posted by Malte Sussdorff on
Could you fix it in 5.2 as well (if it needs fixing) and provide an upgrade script? Thanks.