Summary | db schema update for h3->h4 conversion |
Queue | Horde Base |
Queue Version | 4.0 |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | jan (at) horde (dot) org |
Requester | dan (at) soleks (dot) com |
Created | 04/07/2011 (5203 days ago) |
Due | |
Updated | 09/06/2011 (5051 days ago) |
Assigned | 06/30/2011 (5119 days ago) |
Resolved | 09/06/2011 (5051 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
Assigned to Jan Schneider
State ⇒ Resolved
In the database dump the table is created first without any primary
key and then the primary key is added with a given name eg:
ALTER TABLE ONLY imp_sentmail
ADD CONSTRAINT imp_primary_idx PRIMARY KEY (sentmail_id);
So it can be named anything, but yes, I can't imagine how it got to be the
wrong name in the first place.
The other person that had the problem with exactly the same tables as
me, so they
may be able to shed some light on it - it can't be just peculiar to me.
in standard SQL and that's what we use in Horde (3). Postgres uses
names internally though, and makes them up from the table name.
constraints in PostgreSQL are table_pkey. Why are yours table_idx?
exactly when the unexpected primary key names appeared.
Unfortunately, it looks like I both upgraded the database and horde (to 1.2.5
from an unknown version) on that date, so I can't tell if it was an
artefact of
the database upgrade or the horde upgrade.
I guess its possible that one of the upgrades partially failed and I
had to fix
the primary keys by hand but I don't particularly remember doing that. The
names do seem to be a bit inconsistent to be the result of an automatic
process.
I can investigate further if you have anything you want me to check.
State ⇒ Feedback
different names than those that the upgrade script is expecting. It
attempts to
drop the primary key using an incorrect name which fails, then adds it back
again. The add of course fails with the reported message.
in PostgreSQL are table_pkey. Why are yours table_idx?
indexes, then upgrade script was able to create new ones. Thanks that
you confirm my theory.
The reason it happens on my system, is that the primary key constraints have
different names than those that the upgrade script is expecting. It
attempts to
drop the primary key using an incorrect name which fails, then adds it back
again. The add of course fails with the reported message.
The postgres version is 8.4.2 on centos5, although the database was originally
created on a much earlier version.
Running the following commands before the upgrade, allows the upgrade to
run on my installation.
alter table imp_sentmail drop constraint imp_primary_idx;
alter table turba_shares drop constraint turba_shares_pkey_idx;
alter table kronolith_shares drop constraint kronolith_shares_pkey_idx;
alter table ingo_shares drop constraint ingo_shares_primary_idx;
alter table ingo_rules drop constraint ingo_rules_primary_idx;
alter table mnemo_shares drop constraint mnemo_shares_pkey_idx;
alter table nag_shares drop constraint nag_shares_pkey_idx;
alter table horde_groups drop constraint group_primary_idx;
alter table horde_histories drop constraint history_primary_idx;
alter table horde_perms drop constraint perms_primary_idx;
alter table horde_vfs drop constraint vfs_primary_idx;
There is then a problem with rampage_types which is resolved by running the
failed upgrade again.
State ⇒ No Feedback
postgresql84-server-8.4.5-1.el5_5.1
postgresql84-8.4.5-1.el5_5.1
postgresql84-devel-8.4.5-1.el5_5.1
State ⇒ Feedback
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ db schema update for h3->h4 converstion
Queue ⇒ Horde Base
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
SQLSTATE[42P16]: Invalid table definition: 7 ERROR: multiple primary
keys for table "imp_sentmail" are not allowed
SQLSTATE[42P16]: Invalid table definition: 7 ERROR: multiple primary
keys for table "ingo_rules" are not allowed
SQLSTATE[42P16]: Invalid table definition: 7 ERROR: multiple primary
keys for table "turba_shares" are not allowed
SQLSTATE[42P16]: Invalid table definition: 7 ERROR: multiple primary
keys for table "kronolith_shares" are not allowed
SQLSTATE[42P16]: Invalid table definition: 7 ERROR: multiple primary
keys for table "nag_shares" are not allowed
SQLSTATE[42P16]: Invalid table definition: 7 ERROR: multiple primary
keys for table "mnemo_shares" are not allowed
SQLSTATE[42P16]: Invalid table definition: 7 ERROR: multiple primary
keys for table "horde_groups" are not allowed
SQLSTATE[42P16]: Invalid table definition: 7 ERROR: multiple primary
keys for table "horde_histories" are not allowed
SQLSTATE[42P16]: Invalid table definition: 7 ERROR: multiple primary
keys for table "horde_perms" are not allowed
SQLSTATE[42P16]: Invalid table definition: 7 ERROR: multiple primary
keys for table "horde_vfs" are not allowed
database backend is postgres