Discussion:
Problems doing a restore under 7.4.2
(too old to reply)
Chris White (cjwhite)
2004-04-20 23:25:01 UTC
Permalink
I have just migrated from 7.2.1 to 7.4.2 and I have the following tables
defined in my database.

/* ============================================================ */
/* Table: vm_config */
/* ============================================================ */
create table vm_config
(
Parameter varchar(32) not null,
Value varchar(256) not null,
primary key (Parameter)
);
/* ============================================================ */
/* Table: vm_dbversion */
/* ============================================================ */
create table vm_dbversion
(
dbversion integer not null,
timestamp date not null,
createtime time not null,
primary key (dbversion)
);
/* ============================================================ */
/* Table: vm_mailbox */
/* ============================================================ */
create table vm_mailbox
(
MailboxId varchar(64) not null,
MailboxType integer not null default 0,
Description varchar(64) ,
MailboxSize integer ,
MessageSize integer ,
Tutorial boolean not null default true,
TotalMessageTime integer ,
MessageExpiryTime integer ,
Enabled boolean not null default true,
GreetingType integer not null default 10,
OrphanedTime bigint not null default 0,
LastAccessed bigint ,
ZeroOutNumber varchar(32) ,
primary key (MailboxId)
);

/* ============================================================ */
/* Table: vm_mbxusers */
/* ============================================================ */
create table vm_mbxusers
(
MailboxId varchar(64) not null,
UserDN varchar(256) not null,
Owner boolean not null default false,
foreign key (MailboxId) references vm_mailbox on delete cascade on
update cascade,
primary key (MailboxId, UserDN, Owner)
);

/* ============================================================ */
/* Table: vm_greeting */
/* ============================================================ */
create table vm_greeting
(
GreetingId varchar(64) not null,
GreetingType integer not null,
MessageLength integer ,
MessageSize integer ,
GreetingOid OID ,
MailboxId varchar(64) not null,
foreign key (MailboxId) references vm_mailbox on delete cascade on
update cascade,
primary key (GreetingId)
);
/* ============================================================ */
/* Table: vm_message */
/* ============================================================ */
create table vm_message
(
MessageId varchar(128) not null,
MessageType integer not null default 1,
UseCount integer not null default 1,
Sender varchar(256) not null,
Urgent boolean not null default false,
Private boolean not null default false,
MessageLength integer ,
MessageSize integer ,
MessageTime bigint ,
AttachedMsgId varchar(128) ,
MessageOid OID ,
UTCTime varchar(32) ,
ExpiryTime bigint not null default 0,
foreign key (AttachedMsgId) references vm_message on delete cascade on
update cascade,
primary key (MessageId)
);
/* ============================================================ */
/* Table: vm_usermsg */
/* ============================================================ */
create table vm_usermsg
(
MailboxId varchar(64) not null,
MessageId varchar(128) not null,
State integer not null default 1,
StoreTime bigint not null,
foreign key (MailboxId) references vm_mailbox on delete cascade on
update cascade,
foreign key (MessageId) references vm_message on delete cascade on
update cascade,
primary key (MailboxId, MessageId)
);


I have done a backup of my 7.4.2 database using pg_dump. When I restore
the database using the -c option I get the following error message and
pg_restore fails

pg_restore: [archiver (db)] could not execute query: ERROR: trigger
"RI_ConstraintTrigger_17371" for table "vm_message" does not exist


I see the following definition in the dump file for the specified
trigger
--
-- TOC entry 49 (OID 17371)
-- Name: RI_ConstraintTrigger_17371; Type: TRIGGER; Schema: public;
Owner: voicemail
--
CREATE CONSTRAINT TRIGGER "<unnamed>"
AFTER UPDATE ON vm_message
FROM vm_usermsg
NOT DEFERRABLE INITIALLY IMMEDIATE
FOR EACH ROW
EXECUTE PROCEDURE "RI_FKey_cascade_upd"('<unnamed>', 'vm_usermsg',
'vm_message', 'UNSPECIFIED', 'messageid', 'messageid');

What could be the problem? I was able to backup and restore under 7.2.1
without a problem.

Chris


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Chris White (cjwhite)
2004-04-22 06:45:27 UTC
Permalink
I got around the problem by using the --disable-triggers option on the
restore.

Chris
-----Original Message-----
From: Tom Lane [mailto:***@sss.pgh.pa.us]
Sent: Wednesday, April 21, 2004 9:02 PM
To: ***@cisco.com
Cc: pgsql-***@postgresql.org
Subject: Re: [ADMIN] Problems doing a restore under 7.4.2
Post by Chris White (cjwhite)
I have done a backup of my 7.4.2 database using pg_dump. When I
restore the database using the -c option I get the following error
message and pg_restore fails
pg_restore: [archiver (db)] could not execute query: ERROR: trigger
"RI_ConstraintTrigger_17371" for table "vm_message" does not exist
Probably an ordering issue --- easiest workaround is not to use -c, I'd
think.

If you like, you could try CVS-tip pg_dump to see if it gets the
ordering right.

regards, tom lane


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
Tom Lane
2004-04-22 04:02:05 UTC
Permalink
Post by Chris White (cjwhite)
I have done a backup of my 7.4.2 database using pg_dump. When I restore
the database using the -c option I get the following error message and
pg_restore fails
pg_restore: [archiver (db)] could not execute query: ERROR: trigger
"RI_ConstraintTrigger_17371" for table "vm_message" does not exist
Probably an ordering issue --- easiest workaround is not to use -c,
I'd think.

If you like, you could try CVS-tip pg_dump to see if it gets the
ordering right.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ***@postgresql.org
Loading...