Forum .LRN Q&A: Re: Datamodel Creation Script Error

Collapse
Posted by Ashem Yadava on
Jarkko

The drop script had a syntax error, I fixed it. So its running fine without any errors. The create script is also able to create the privileges, table, etc successfully.

However, I get the following error while running the create script. This is the only error now.

function acs_object_type__create_type("unknown","unknown","unknown","unknown","unknown","unknown", "unknown") does not exist.

FOLLOWING IS THE CONCERNING CODE

-- Create a room object
create function inline_0()
returns integer as '
declare
attr_id acs_attributes.attribute_id%TYPE;
begin
  /*I have also tried with
  PERFORM acs_object_type__create_type(
  */
attr_id :=  acs_object_type__create_type (
  ''room'',          -- object_type
  ''Chat Room'',    -- pretty_name
  ''Chat Rooms'',    -- pretty_plural
  ''acs_object'',    -- supertype
  ''chat_rooms'',    -- table_name
  ''room_id'',      -- id_column
  null              -- name_method
  );

-- Create attributes for object room
-- Attribute: pretty name
attr_id := acs_attribute__create_attribute (
  ''room'',          -- object_type
  ''pretty_name'',  -- attribute_name
  ''string'',        -- datatype
  ''Room Name'',    -- pretty_name
  ''Room Names''    -- pretty_plural
  );

-- Attribute: detail
attr_id := acs_attribute__create_attribute (
  ''room'',          -- object_type
  ''detail'',        -- attribute_name
  ''string'',        -- datatype
  ''Detail'',        -- pretty_name
  ''Details''        -- pretty_plural
  );

-- Attribute: moderated
attr_id := acs_attribute_create_attribute (
  ''room'',          -- object_type
  ''moderated_p'',    -- attribute_name
  ''boolean'',        -- datatype
  ''Moderated'',      -- pretty_name
  ''Moderated''      -- pretty_plural
  );

-- Attribute: active
attr_id := acs_attribute_create_attribute (
  ''room'',          -- object_type
  ''active_p'',      -- attribute_name
  ''boolean'',      -- datatype
  ''Activated'',    -- pretty_name
  ''Activated''      -- pretty_plural
  );

return 0;

end;'

language plpgsql;

select inline_0();
drop function inline_0();

-----------------------------

Many thanks for the unending help :-))

Ashem

Collapse
Posted by Jade Rubick on
I haven't looked over everything carefully, but I'm sure that you can't have null for the name method.

You can look at project-manager or other applications for examples of this.

Collapse
Posted by Jarkko Laine on
Jade,

maybe it's different because it's content_type__create_type, but at least the package developer guide seems to be setting name_method as null:

select content_type__create_type(
    'mfp_note',                    -- content_type
    'content_revision',            -- supertype
    'MFP Note',                    -- pretty_name,
    'MFP Notes',                  -- pretty_plural
    'mfp_notes',                  -- table_name
    'note_id',                    -- id_column
    null                          -- name_method
);