Forum OpenACS Development: Re: Major revision of the XOTcl interface to the Content Repository and to ACS objects and ACS Object Types in general

Hi Gustaf,

System is a fresh install of 5.3.2 on a pg 8.1.10 (originally tried on 8.0)

Actually printing the log message I get;
Notice: CREATE ATT ::xo::db::sql::acs_attribute create_attribute
-object_type acs_object
-attribute_name object_id
-datatype integer
-pretty_name {Object ID}
-min_n_values 1
-max_n_values 1
[05/Dec/2007:17:41:28][27003.3072904080][-sched:10-] Error: Ns_PgExec: result st"tus: 7 message: ERROR: invalid input syntax for integer: "null

[05/Dec/2007:17:41:28][27003.3072904080][-sched:10-] Error: Tcl exception:
Database operation "0or1row" failed
"exception ERROR, "ERROR: invalid input syntax for integer: "null
")

while executing
"ns_pg_bind 0or1row $db $sql"
invoked from within
"ns_set value [ns_pg_bind 0or1row $db $sql] 0 "
invoked from within
"return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]"
("uplevel" body line 3)
invoked from within
"uplevel 1 $code_block "
invoked from within
"db_with_handle -dbn $dbn db {
#ns_log notice "--sql=$sql"
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}"
(procedure "create_attribute" line 17)
::xo::db::sql::acs_attribute->create_attribute
invoked from within
"::xo::db::sql::acs_attribute create_attribute -object_type $object_type -attribute_name $column_name -datatype $datatype -pretty_name $pretty_name..."
(procedure "create_attribute" line 16)
::xo::db::Object::slot::object_id ::xo::db::Attribute->create_attribute
invoked from within
"my create_attribute"
(procedure "init" line 8)
invoked from within
"::xotcl::next"
(procedure "init" line 2)
::xo::db::Object::slot::object_id ::xotcl::Slot::Optimizer->init
::xo::db::Attribute ::xotcl::Class->create
invoked from within
"::xo::db::Attribute create ::xo::db::Object::slot::object_id \
-set min_n_values 1 \
-set max_n_values 1 \
-set manager ::xo::db::Object::slot::obj..."
invoked from within
"ns_ictl update"

also errors at this point;
[05/Dec/2007:17:40:08][27003.3086079680][-main-] Notice: CREATE ATT ::xo::db::sql::acs_attribute create_attribute -object_type apm_package -attribute_name instance_name -datatype string -pretty_name MESSAGE KEY MISSING: 'xo.Package-instance_name' -min_n_values 1 -max_n_values 1
[05/Dec/2007:17:40:08][27003.3086079680][-main-] Error: Ns_PgExec: result status: 7 message: ERROR: invalid input syntax for integer: "null
"

[05/Dec/2007:17:40:08][27003.3086079680][-main-] Error: Error sourcing /usr/local/acs/oacs_test/packages/xotcl-core/tcl/06-package-procs.tcl:
Database operation "0or1row" failed
(exception ERROR, "ERROR: invalid input syntax for integer: "null
"
")
during '::xo::Package slots'
::xo::Package ::xotcl::Object->configure
::xo::PackageMgr ::xotcl::Class->create
invoked from within
"PackageMgr create ::xo::Package -superclass ::xo::db::Object -table_name apm_packages -id_column package_id -object_type apm_package -package_key a..."
(in namespace eval "::xo" script line 93)
invoked from within
"namespace eval ::xo {
#
# Meta-Class for Application Package Classes
#

Class create ::xo::PackageMgr \
-superclass ::xo::db::Class \
..."
(file "/usr/local/acs/oacs_test/packages/xotcl-core/tcl/06-package-procs.tcl" line 9)

From the table below I'm assuming the problem is with sort_order not being set as sort_order defaults to null from the info in the xotcl-core api-docs for ::xo::db::sql::acs_attribute proc create_attribute

oacs_532_81=# \d acs_attributes
Table "public.acs_attributes"
Column | Type | Modifiers
----------------+------------------------+--------------------------------------------
attribute_id | integer | not null
object_type | character varying(100) | not null
table_name | character varying(30) |
attribute_name | character varying(100) | not null
pretty_name | character varying(100) | not null
pretty_plural | character varying(100) |
sort_order | integer | not null
datatype | character varying(50) | not null
default_value | text |
min_n_values | integer | not null default 1
max_n_values | integer | not null default 1
storage | character varying(13) | default 'type_specific'::character varying
static_p | boolean | default false
column_name | character varying(30) |
Indexes:
"acs_attributes_attribute_id_pk" PRIMARY KEY, btree (attribute_id)
"acs_attributes_attr_name_un" UNIQUE, btree (attribute_name, object_type)
"acs_attributes_pretty_name_un" UNIQUE, btree (pretty_name, object_type)
"acs_attributes_sort_order_un" UNIQUE, btree (attribute_id, sort_order)
"acs_attrs_datatype_idx" btree (datatype)
"acs_attrs_obj_type_idx" btree (object_type)
"acs_attrs_tbl_name_idx" btree (table_name)
Check constraints:
"acs_attributes_max_n_values_ck" CHECK (max_n_values >= 0)
"acs_attributes_min_n_values_ck" CHECK (min_n_values >= 0)
"acs_attributes_n_values_ck" CHECK (min_n_values <= max_n_values)
"acs_attributes_storage_ck" CHECK ("storage"::text = 'type_specific'::text OR "storage"::text = 'generic'::text)
Foreign-key constraints:
"acs_attributes_datatype_fk" FOREIGN KEY (datatype) REFERENCES acs_datatypes(datatype)
"acs_attributes_object_type_fk" FOREIGN KEY (object_type) REFERENCES acs_object_types(object_type)
"acs_attrs_obj_type_tbl_name_fk" FOREIGN KEY (object_type, table_name) REFERENCES acs_object_type_tables(object_type, table_name)

Other packages seem to have installed fine.
5.3.2 versions of xotcl-code and xowiki have installed fine on a parallel system with the same oacs core.

cheers
Matthew

i have just now set up a fresh version of openacs 5.3.2 (from the tar file) and installed the head version of xotcl-core and xowiki, it installs nicely and runs the regression test. i have tried with 8.2.0, since i have no 8.1 version lying around anymore.

What is different on your "parallel systems", where you installed successfully? my strongest guess is that there is something special with your configuration.

some observations from your reports:
a) what is the strange quote in 'Ns_PgExec: result st"tus: 7 message: '??
b) in the "ERROR: invalid input syntax for integer:" there is a line break between null and the double quote
c) you did not report back the SQL statement causing the error, as i requested. It should look like:

CONTEXT:  SQL statement "INSERT INTO acs_attributes (attribute_id, object_type, table_name, column_name, attribute_name, pretty_name, pretty_plural, sort_order, datatype, default_value, min_n_values, max_n_values, storage, static_p) values ( $1 ,  $2 ,  $3 ,  $4 ,  $5 ,  $6 ,  $7 ,  $8 ,  $9 ,  $10 ,  $11 ,  $12 ,  $13 ,  $14 )"
PL/pgSQL function "acs_attribute__create_attribute" line 30 at SQL statement
): '
        select acs_attribute__create_attribute('acs_object', 'object_id', 'integer', 'Object ID', null, null, null, null, '1', '1', null, 'type_specific', 'f'
)

I have the suspicion that there might be line-breaks in the passed arguments of the statement as well.

Can it be, that you are working on windows, an that some crlf line-terminators causing the problem?

What do you see, if you run

::xo::db::sql::acs_attribute get_function_args acs_attribute create_attribute 
from ds/shell?