Re: DELETE FROM fails with error

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: chris Gnther <guenther(at)uscreen(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: DELETE FROM fails with error
Date: 2001-03-28 20:00:09
Message-ID: Pine.BSF.4.21.0103281159100.75849-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


I was going to guess that it was something related to the
foreign key, but I can't imagine why that would be affected
by a delete on the referencing table (there shouldn't be
a trigger there anyway).

Can you send full schema with constraints for the tables?

On Wed, 28 Mar 2001, chris Gnther wrote:

> Hi folks,
>
> I have the problem that I can't delete datasets out of my tables. It's like that:
> I have a table:
> tblshop
> ID_Shop oid with sequence
> -------
> Sh_Name
> ID_Country
> ...
>
> there is an index on ID_Country
>
>
> I have a second table:
> tblcountry
> ID_Country oid with sequence
> ----------
> C_Name
> ...
>
> I have a reference between these two tables pointing from tblshop.ID_Country to
> tblcountry.ID_Country
>
> When I try to delete a row from tblshop I get the error that postgres can't find
> the attribute id_shop. My SQL-command looks like follows:
>
> DELETE FROM tblshop WHERE tblshop."ID_Shop" = 12
>
> the same happens when I try to do:
>
> DELETE FROM tblshop WHERE tblshop."ID_Country" = 3
>
> I also tried this query without quotes, with simple quotes (') without the leading
> tablename and so on, but I always get the error-message:
>
> ERROR: Attribute 'id_shop' not found
>
> Please, can anyone help me out? It is really anoying when you can't delete datasets
> especially because my application is already online (I use postgres with PHP) and
> there are 20 tables with alltogether 120 MB of data in it

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Eckermann 2001-03-28 20:43:26 RE: counting distinct rows on more than one column
Previous Message Tom Lane 2001-03-28 19:51:39 Re: counting distinct rows on more than one column