Re: Rows missing from table despite FK constraint - Mailing list pgsql-general

From Konrad Garus
Subject Re: Rows missing from table despite FK constraint
Date
Msg-id 6645f6441001080939x51bdc4e2h437d39eda23facc7@mail.gmail.com
Whole thread Raw
In response to Re: Rows missing from table despite FK constraint  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
2010/1/8 Adrian Klaver <adrian.klaver@gmail.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

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Rows missing from table despite FK constraint
Next
From: Tom Lane
Date:
Subject: Re: Rows missing from table despite FK constraint