Re: Can't insert date in field with foreign key

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: =?iso-8859-1?Q?Bj=F6rn_Platzen?= <bjoern(dot)platzen(at)momatec(dot)de>
Cc: PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can't insert date in field with foreign key
Date: 2004-11-11 08:18:10
Message-ID: 20041111081810.GA96805@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Net Virtual Mailing Lists 2004-11-11 08:23:08 Re: Important Info on comp.databases.postgresql.general
Previous Message xxxxxxx 2004-11-11 08:09:11 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX