Re: Trouble with foreign key

From: Kyle Wilcox <Kyle(dot)Wilcox(at)noaa(dot)gov>
To: otakarek(at)post(dot)cz
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trouble with foreign key
Date: 2008-04-09 14:04:19
Message-ID: 47FCCCE3.4070302@Noaa.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How is your foreign key defined?

From a quick look it seems the column is named "_stamp" not
"_tmp_stamp" in the tmp_stamp table.

otakarek(at)post(dot)cz wrote:
> Hi,
>
> there is a problem with foreign key (PG 8.3RC2). Please, look at below. I don't understand this behavior. Why this INSERT is ending with this error message. In my opinion, the key is obviously present. Thank you.
> --
> Otakarek
>
> # INSERT INTO www_es_orderhead_cs(_status,_tmp_ip,_tmp_stamp) VALUES('n','xx.121.111.31','2f980de9f2297c7902f3415f6537c6be');
>
> ERROR: insert or update on table "www_es_orderhead_cs" violates foreign key constraint "www_es_orderhead_cs__tmp_stamp_fkey"
> DETAIL: Key (_tmp_stamp)=(2f980de9f2297c7902f3415f6537c6be) is not present in table "tmp_stamp".
>
> # SELECT * from tmp_stamp;
> _ip | _stamp | _expired | _var
> ------------------+----------------------------------+-------------------------------+------
> xx.121.111.31/32 | 2f980de9f2297c7902f3415f6537c6be | 2008-04-08 17:49:33.193914+02 |
> (1 row)
>

--

Kyle Wilcox
NOAA Chesapeake Bay Office
410 Severn Avenue
Suite 107A
Annapolis, MD 21403
office: (410) 295-3151
Kyle(dot)Wilcox(at)noaa(dot)gov

A: It takes over twice as long to understand the conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the worst thing about plain text email discussions?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2008-04-09 14:22:16 Re: select statement fails
Previous Message Tom Lane 2008-04-09 14:01:52 Re: tsvector_update_trigger throws error "column is not of tsvector type"