Re: Rows missing from table despite FK constraint

From: Konrad Garus <konrad(dot)garus(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>, pgsql-general(at)postgresql(dot)org
Subject: Re: Rows missing from table despite FK constraint
Date: 2010-01-08 17:39:16
Message-ID: 6645f6441001080939x51bdc4e2h437d39eda23facc7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/1/8 Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>:
> This looks a lot like this thread:
> http://archives.postgresql.org/pgsql-general/2009-12/msg00726.php
>
> Could we see the schema and indexes for this table?

Table "public.attachment"
Column | Type | Modifiers | Description
--------------------+-----------------------------+-----------+-------------
attachment_id | integer | not null |
entity_kind | character varying(15) | |
entity_id | integer | |
attached_by | integer | not null |
when_attached | timestamp without time zone | not null |
when_uploaded | timestamp without time zone | |
file_name | character varying(255) | not null |
file_size | integer | not null |
hash | character varying(50) | |
description | character varying(300) | |
thumb | bytea | |
target_entity_kind | character varying(15) | |
target_entity_id | integer | |
file_size_enc | bigint | |
hash_enc | character varying(50) | |
secure_key | bytea | |
status | character varying(50) | |
width | integer | |
height | integer | |
lat | numeric(10,7) | |
lon | numeric(10,7) | |
created_date | timestamp without time zone | |
created_time | integer | |
Indexes:
"attachment_pkey" PRIMARY KEY, btree (attachment_id)
"attachment_by_entity" btree (entity_kind, entity_id)
"attachment_by_entity_id" btree (entity_id)
"attachment_by_target_entity" btree (target_entity_kind, target_entity_id)
"attachment_by_uploaded" btree (when_uploaded)
"attachment_by_user" btree (attached_by)
"attachment_hash_ix" btree (hash)
Foreign-key constraints:
"fk8af75923d38260d2" FOREIGN KEY (attached_by) REFERENCES usr(usr_id)
Rules:
attachment_no_delete AS
ON DELETE TO attachment DO INSTEAD SELECT no_delete() AS no_delete
Has OIDs: no

--
Konrad Garus

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-01-08 17:43:54 Re: Rows missing from table despite FK constraint
Previous Message Adrian Klaver 2010-01-08 17:35:07 Re: Rows missing from table despite FK constraint