Re: Can't insert date in field with foreign key - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Can't insert date in field with foreign key
Date
Msg-id 20041111081810.GA96805@winnie.fuhr.org
Whole thread Raw
In response to Can't insert date in field with foreign key  (Björn Platzen <bjoern.platzen@momatec.de>)
List pgsql-general
On Thu, Nov 11, 2004 at 08:13:16AM +0100, Bjoern Platzen wrote:

> insert  into "T_OEPNV_HST_LIN" ("HST_NR", "LIN_U_NAME", "LIN_KAT",
> "LIN_NAME_O", "LIN_NAME_I") values  ('10001', 'Stadtwerke Marburg GmbH',
> 'Bus', 'C', '11103');
> does not work while
> select * from "T_OEPNV_HST" where "HST_NR"='10001';
> returns
>  HST_ID | HST_NR | HST_NAME |                HST_COORD
> --------+--------+----------+------------------------------------------
>   23555 | 10001  | Aff?ller | SRID=31467;POINT(3483856.148 5632168.48)
> (1 Zeile)

The foreign key constraint on T_OEPNV_HST_LIN.HST_NR references the
wrong field in T_OEPNV_HST.  Since you didn't specify a field, it's
referencing the primary key HST_ID instead of HST_NR.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-general by date:

Previous
From: xxxxxxx@xxx.xxx
Date:
Subject: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Next
From: Phil Endecott
Date:
Subject: Re: Analyse - max_locks_per_transaction - why?