Forum OpenACS Development: acs_data_links error when upgrading acs-kernel

Hi Ryan,

I got the following error when upgrading acs-kernel:

Error: apm_package_install: Error installing Kernel version 5.6.0d4: psql:upgrade-5.6.0d3-5.6.0d4.sql:3: ERROR: cannot drop index acs_data_links_un because constraint acs_data_links_un on table acs_data_links requires it
HINT: You may drop constraint acs_data_links_un on table acs_data_links instead.
psql:upgrade-5.6.0d3-5.6.0d4.sql:7: ERROR: relation "acs_data_links_un" already exists

psql:upgrade-5.6.0d3-5.6.0d4.sql:3: ERROR: cannot drop index acs_data_links_un because constraint acs_data_links_un on table acs_data_links requires it
HINT: You may drop constraint acs_data_links_un on table acs_data_links instead.
psql:upgrade-5.6.0d3-5.6.0d4.sql:7: ERROR: relation "acs_data_links_un" already exists

invoked from within
"db_source_sql_file -callback $callback $path/$file_path"
(procedure "apm_package_install_data_model" line 32)
invoked from within
"apm_package_install_data_model -callback $callback -data_model_files $data_model_files $spec_file_path"
invoked from within
"if { $load_data_model_p } {
apm_package_install_data_model -callback $callback -data_model_files $data_model_files $spec_file_path
..."
("uplevel" body line 55)
invoked from within
"uplevel $body "

Collapse
Posted by Ryan Gallimore on
Thanks, Emmanuelle. This is now fixed on HEAD.
Collapse
Posted by Don Baccus on
Ryan - you should continue to use a UNIQUE table constraint for the three columns rather than manually generate the index. That's the standard SQL way to do it and works equivalently in Oracle and PG.

(as it happens both implement UNIQUE constraints by building the multi-column index but please, stick to standard SQL when possible).

Collapse
Posted by Ryan Gallimore on
Hi Don,

I realize that a unique constraint is the standard, however this Oracle post seems to prove that a unique index is not always created when a unique constraint is created. It recommends creating a unique index explicitly.

If that was the correct method for Oracle, I wanted to be consistent in PG and use a unique index as well.

With the Oracle quirk in mind, how should I change my script?

Collapse
Posted by Ryan Gallimore on
Hi Don - I updated the SQL scripts on HEAD to use UNIQUE constraints.
Collapse
Posted by Emmanuelle Raffenne on
Thank you Ryan.