Forum OpenACS Development: Error Upgrading FAQ 4.7.4 to 5.2.d4

Hi!

I'm trying to upgrade from OACS 5.1 and OACS 5.2. Everything is fine but I had errors upgrading FAQ and Photo Album

When upgrading, Error was: ...
"
[-default:31-] Notice: Loading packages/faq/tcl/q-and-a-procs.tcl...
[-default:31-] Notice: Loaded packages/faq/tcl/q-and-a-
[-default:31-] Notice: apm_invoke_callback_proc: invoking callback before-upgrade with command faq::install::package_upgrade -from_version_name 4.7\
.4 -to_version_name 5.2.0d4
NOTICE: adding missing FROM-clause entry for table "acs_object_id_seq"
CONTEXT: SQL statement "SELECT acs_object_id_seq.nextval from dual"
PL/pgSQL function "acs_object__new" line 17 at select into variables
PL/pgSQL function "acs_object__new" line 11 at return
PL/pgSQL function "acs_sc_impl__new" line 9 at assignment
[-default:31-] Error: Ns_PgExec: result status: 7 message: ERROR: duplicate key violates unique constraint "acs_sc_impl_alias_un"
CONTEXT: SQL statement "insert into acs_sc_impl_aliases ( impl_id, impl_name, impl_contract_name, impl_operation_name, impl_alias, impl_pl ) values ( $1 , $2 , $3 , $4 , $5 , $6 )"
PL/pgSQL function "acs_sc_impl_alias__new" line 12 at SQL statement

[-default:31-] Error: apm_package_install: Error installing FAQ version 5.2.0d4: Transaction aborted: Database operation "0or1row" failed
(exception ERROR, "ERROR: duplicate key violates unique constraint "acs_sc_impl_alias_un"
CONTEXT: SQL statement "insert into acs_sc_impl_aliases ( impl_id, impl_name, impl_contract_name, impl_operation_name, impl_alias, impl_pl ) values ( $1 , $2 , $3 , $4 , $5 , $6 )"
PL/pgSQL function "acs_sc_impl_alias__new" line 12 at SQL statement
")
"

Error is duplicate key violates unique constraint "acs_sc_impl_alias_un" and checking who is calling this sql statement I think is

acs_sc::impl::new_from_spec -spec $spec

in

ad_proc -private faq::sc::register_faq_q_and_a_fts_impl

Anybody knows what happen and how can I fix it? It is not a problem with sql upgrade script, is a tcl script (faq::install::package-upgrade)

And it seems to be same error in my Photo-Album Package upgrading

Thanks so much

Collapse
Posted by Iqbal Shirol on
Hey Cesareo,

Check "impl_name, impl_contract_name, impl_operation_name" values before entering into the table "acs_sc_impl_aliases" because the unique constraint "acs_sc_impl_alias_un" is voilated if any of the mentioned values are already present in the "acs_sc_impl_aliases" table.

This is happening because, anyone has already run this upgrade till the halfway.

The solution to this is:
1. Just get the value of impl_id before the insert command.
2. Delete the row from the table "acs_sc_impl_aliases" having the impl_id with on cascade command, as the primary key is "impl_id" is linked with the "acs_sc_impls" table.
3. Run the upgrade again (proc).

This may solve your problem.

Cheers !!!
IQBAL

Collapse
Posted by Iqbal Shirol on
Heya..

I missed an important thing.
Please use delete with impl_id and impl_alias.
Don't forget this as if you don't include impl_alias in the delete, it will delete the related impl_aliases also..

Cheers !!!
IQBAL