6.0.0-beta1
7/5/25

[#9835] db schema update for h3->h4 conversion
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

History
09/06/2011 04:55:03 PM Jan Schneider Comment #14
Assigned to Jan Schneider
State ⇒ Resolved
Reply to this comment
Should be fixed in recent Horde_Db versions.
07/30/2011 12:08:07 PM Jan Schneider Comment #13 Reply to this comment
Dan?
07/01/2011 09:39:31 PM sr (at) parabola (dot) me (dot) uk Comment #12 Reply to this comment

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.


07/01/2011 09:01:51 PM Jan Schneider Comment #11 Reply to this comment
Well, the point is that primary keys don't have a name. At least not 
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.
07/01/2011 08:53:35 PM sr (at) parabola (dot) me (dot) uk Comment #10 Reply to this comment
So, the question is why? The default names for primary key 
constraints in PostgreSQL are table_pkey. Why are yours table_idx?
I have database dumps every day for the time I have used horde. So I can tell
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.
06/30/2011 10:10:47 AM Jan Schneider Summary ⇒ db schema update for h3->h4 conversion
 
06/30/2011 10:09:12 AM Jan Schneider Comment #9
State ⇒ Feedback
Reply to this comment
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.
So, the question is why? The default names for primary key constraints 
in PostgreSQL are table_pkey. Why are yours table_idx?
05/19/2011 09:24:24 PM dan (at) soleks (dot) com Comment #8 Reply to this comment
I did exactly what you described in your post - manually dropped 
indexes, then upgrade script was able to create new ones. Thanks that 
you confirm my theory.

[Show Quoted Text - 30 lines]
05/19/2011 09:13:09 PM sr (at) parabola (dot) me (dot) uk Comment #7 Reply to this comment
I see this problem.

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.

05/18/2011 03:51:38 PM Jan Schneider Comment #6
State ⇒ No Feedback
Reply to this comment
Not much we can do then. It works fine on our Postgres test system with 8.4.8.
04/28/2011 04:45:57 PM dan (at) soleks (dot) com Comment #5 Reply to this comment
Are you able to run PHPUnit tests on that server?
nope
04/19/2011 04:17:59 PM Jan Schneider Comment #4 Reply to this comment
Are you able to run PHPUnit tests on that server?
04/08/2011 02:53:00 PM dan (at) soleks (dot) com Comment #3 Reply to this comment
Which version of Postgres?
postgresql84-libs-8.4.5-1.el5_5.1
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
04/08/2011 12:46:08 PM Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
Which version of Postgres?
04/07/2011 03:49:07 PM dan (at) soleks (dot) com Comment #1
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ db schema update for h3->h4 converstion
Queue ⇒ Horde Base
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
when i did db schema conversion as part of h3->h4 upgrade i got the following:

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

Saved Queries