Forum OpenACS Development: one acs_object per package

Request notifications

Collapse
Posted by Iuri Sampaio on
Hi there,

i have created a simple datamodel and i want to create 4 objects to be used in that package.

I got the followed error at logs. It points to a duplicated package_name.

Does they mean, that i can only have one object per package?

openacs@debian:~$ psql -f packages/todo/sql/postgresql/todo-create.sql openacs

psql:packages/todo/sql/postgresql/todo-create.sql:12: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "todo_item_pk" for table "todo_item"
CREATE TABLE
CREATE FUNCTION
inline_0
----------
0
(1 row)

DROP FUNCTION
CREATE FUNCTION
psql:packages/todo/sql/postgresql/todo-create.sql:56: ERROR: duplicate key violates unique constraint "acs_object_types_pkg_name_un"
CONTEXT: SQL statement "insert into acs_object_types (object_type, pretty_name, pretty_plural, supertype, table_name, id_column, abstract_p, type_extension_table, package_name, name_method) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 )"
PL/pgSQL function "acs_object_type__create_type" line 37 at SQL statement
SQL statement "SELECT acs_object_type__create_type ( 'process_item', 'Process Item', 'Process Items', 'project_item', 'todo_item', 'item_id', 'todo', 'f', null, null )"
PL/pgSQL function "inline_0" line 2 at perform
DROP FUNCTION
CREATE FUNCTION
psql:packages/todo/sql/postgresql/todo-create.sql:79: ERROR: duplicate key violates unique constraint "acs_object_types_pkg_name_un"
CONTEXT: SQL statement "insert into acs_object_types (object_type, pretty_name, pretty_plural, supertype, table_name, id_column, abstract_p, type_extension_table, package_name, name_method) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 )"
PL/pgSQL function "acs_object_type__create_type" line 37 at SQL statement
SQL statement "SELECT acs_object_type__create_type ( 'milestone_item', 'Milestone Item', 'Milestone Items', 'project_item', 'todo_item', 'item_id', 'todo', 'f', null, null )"
PL/pgSQL function "inline_0" line 2 at perform
DROP FUNCTION
CREATE FUNCTION
psql:packages/todo/sql/postgresql/todo-create.sql:113: ERROR: duplicate key violates unique constraint "acs_object_types_pkg_name_un"
CONTEXT: SQL statement "insert into acs_object_types (object_type, pretty_name, pretty_plural, supertype, table_name, id_column, abstract_p, type_extension_table, package_name, name_method) values ( $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 )"
PL/pgSQL function "acs_object_type__create_type" line 37 at SQL statement
SQL statement "SELECT acs_object_type__create_type ( 'task_item', 'Task Item', 'Task Items', 'acs_object', 'todo_item', 'item_id', 'todo', 'f', null, null )"
PL/pgSQL function "inline_0" line 2 at perform
DROP FUNCTION
CREATE FUNCTION
CREATE FUNCTION

Collapse
Posted by Ryan Gallimore on
Hi Iuri,

When creating object types, package refers to the plpgsql package. You may leave this as null in your acs_object_type__create_type call, as by default, it will use the object type.

See acs_object_type__create_type function and the acs_object_types_pkg_name_un constraint.