pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gauri Kanekar <meetgaurikanekar@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Partitioned Tables Foreign Key Constraints Problem
Date: Thu, 24 Jul 2008 15:45:41 +0530
Message-ID: <7e4ba9550807240315q22c955a7t4c3895b94aa2138d@mail.gmail.com> (raw)

Hi all,

Have a problem related to partition tables.

We have the following schema's :

master -
id integer (PRIMARY KEY)
cid integer

child1, child2 are the child tables of master table. Here "cid" is the field
used for partitioning.

We have another table called
other_tbl -
id integer (PRIMARY KEY)
m_id integer (FOREIGN KEY FROM master(id))

Now the problem is, since other_tbl->m_id referenced from master->id, if we
try to insert any vales in "other_tbl" for m_id its checks it presence in
only master table and not in its child table. As the master table is always
empty in partitions tables a foreign key violation ERROR is being given.

How can we define the Foreign_key constraint on "other_tbl" based upon any
partitioned table field.

-- 
Regards
Gauri

view thread (2+ messages)  latest in thread

Message-ID: <7e4ba9550807240315q22c955a7t4c3895b94aa2138d@mail.gmail.com>
Permalink:  ../7e4ba9550807240315q22c955a7t4c3895b94aa2138d@mail.gmail.com/
Also on:    postgresql.org/message-id/7e4ba9550807240315q22c955a7t4c3895b94aa2138d@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: meetgaurikanekar@gmail.com
  Subject: Re: Partitioned Tables Foreign Key Constraints Problem
  In-Reply-To: <7e4ba9550807240315q22c955a7t4c3895b94aa2138d@mail.gmail.com>
  References: <7e4ba9550807240315q22c955a7t4c3895b94aa2138d@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox