Strange Error, with unique key

From: john(dot)murdoch(at)ig(dot)com(dot)br
To: <pgsql-general(at)postgresql(dot)org>
Subject: Strange Error, with unique key
Date: 2003-04-09 03:46:17
Message-ID: 20030409034619.12841474E42@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I pasted here, from the begining of the database creation for explain it:

[xpy(at)furtab xpy]$ dropdb laboratorio
DROP DATABASE
[xpy(at)furtab xpy]$ createdb laboratorio
CREATE DATABASE
[xpy(at)furtab xpy]$ psql laboratorio
Welcome to psql, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

laboratorio=> CREATE TABLE PESSOA_RESPONSAVEL
laboratorio-> (
laboratorio(> PESSOA INTEGER NOT NULL,
laboratorio(> CODIGO_CONSELHO VARCHAR,
laboratorio(> ESPECIALIDADE INTEGER NOT NULL,
laboratorio(> PRIMARY KEY (PESSOA, ESPECIALIDADE)
laboratorio(> );
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
'pessoa_responsav
el_pkey' for table 'pessoa_responsavel'
CREATE
laboratorio=> CREATE TABLE RESULTADO_EXAME
laboratorio-> (
laboratorio(> NR_PEDIDO INTEGER NOT NULL,
laboratorio(> EXAME INTEGER NOT NULL,
laboratorio(> SEQUENCIA SMALLINT NOT NULL,
laboratorio(> RESULTADO MONEY,
laboratorio(> PESSOA INTEGER NOT NULL,
laboratorio(> PRIMARY KEY (NR_PEDIDO, EXAME, SEQUENCIA)
laboratorio(> );
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
'resultado_exame_
pkey' for table 'resultado_exame'
CREATE
laboratorio=> ALTER TABLE RESULTADO_EXAME ADD FOREIGN KEY (PESSOA)
REFERENCES PE
SSOA_RESPONSAVEL (PESSOA);
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ERROR: UNIQUE constraint matching given keys for referenced table
"pessoa_respo
nsavel" not found
laboratorio=>

Anyone knows what is this error about?
If I am right this pessoa_responsvel is already a unique key (pk).

_________________________________________________________
Voce quer um iGMail protegido contra vrus e spams?
Clique aqui: http://www.igmailseguro.ig.com.br

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas T. Thai 2003-04-09 04:22:15 PgLOGd
Previous Message Corey Scott 2003-04-09 03:30:48 Re: select random row from a group