Forum OpenACS Development: Problems with create_type

Collapse
Posted by Jack Purswani on
Hi Everyone I am having some problems witht he droping and creating of 'type'. I was hoping someone could point me in the right direction as I have no idea what I doing wrong. The create code looks like this:

create table cr_wp_presentations_audience (
	id 		integer  
                        references cr_revisions,
	presentation_id	integer
			constraint cr_wp_paud_pid_nn
			not null
			constraint cr_wp_paud_pid_fk
                       	references cr_wp_presentations
);

...

begin;
select content_type__create_type (
    		'cr_wp_presentation_audience',
		'content_revision',
    		' WimpyPoint  Presentation  Audience',
    		'WimpyPoint Presentation Audience',
    		'cr_wp_presentations_audience',
		'id',
	        null
  );
end;

And the drop code looks like this:
begin;
select content_type__drop_type(
	'cr_wp_presentation_audience',
	'f',
	'f'
);

end;

The Error I am getting is:

psql:wp-slim-create10.sql:176: ERROR:  Attempt to insert rule
"_RETcr_wp_presentations_audienc" failed: already exists

I have tried a number of different ways and such but still - no luck. Would someone know what is going on? Thanks Jack
Collapse
Posted by Dan Wickstrom on
When a content type is created, a rule is placed on the input view to handle inserting data for the new type. The rule is updated each time the type is changed such as when adding a new attribute. It looks like the old rule is not being dropped when the content type trigger is refreshed, and I wonder if it might be due to truncation of the rule name. Try the following and post the result:

	select rule_exists('cr_wp_presentations_audience_r','cr_wp_presentations_audiencei');

Collapse
Posted by Jack Purswani on
Hi

Thanks for that. It was indeed the truncation of the name. Solved this by shortening the name to fit.

Thanks again.
Jack

Collapse
Posted by Jack Purswani on
The problems have now been solved thanks to all that have helped us
achieve this goal