Problem using pg_restore with -a option

Поиск
Список
Период
Сортировка
От Luís Sousa
Тема Problem using pg_restore with -a option
Дата
Msg-id 44F84649.9050502@ualg.pt
обсуждение исходный текст
Ответы Re: Problem using pg_restore with -a option  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: Problem using pg_restore with -a option  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
Hi all,

I'm using PostgreSQL 7.4.7-6sarge2 (debian)

Using the schema below, doing a pg_dump -Fc, delete all data, and a
pg_restore -a, the sequence of inserting data isn't correct issuing an
error.
Could this be a bug?

Notice that on schema, table periodo depends on tipo, but the sequence
is table periodo, then table  tipo and after table periodo is changed to
reference tipo.

My schema file:
drop table periodo cascade ;
drop table tipo cascade ;

create table periodo (
  "idPeriodo"               serial not null,
  "idTipo"                  int4,
  designacao                varchar(50),
  constraint pk_Periodo primary key ("idPeriodo")
) ;

create table tipo (
  "idTipo"                  serial not null,
  tipo                      varchar(5),
  designacao                varchar(50),
  constraint pk_Tipo primary key ("idTipo")
) ;

alter table periodo add constraint fk_tipo
  foreign key ("idTipo")
  references tipo ("idTipo")  ;

My data on tables:
INSERT INTO tipo (tipo,designacao) VALUES ('T','Type');
INSERT INTO periodo ("idTipo",designacao) VALUES (1,'periodo');

Error:
pg_restore: ERROR:  insert or update on table "periodo" violates foreign
key constraint "fk_tipo"
DETAIL:  Key (idTipo)=(1) is not present in table "tipo".

Best regards,
Luís Sousa



В списке pgsql-admin по дате отправления:

Предыдущее
От: "Paul B. Anderson"
Дата:
Сообщение: Vacuum error on database postgres
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Vacuum error on database postgres