Re: Table Inheritence and Partioning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently foreign keys don't work that way. You will need your data to be in 
table persons if you want the foreign key to work correctly. Otherwise you 
could create your own trigger to ensure the foreign key restriction you need.

I'm no expert at all and it seems there are non trivial issues that have to be 
solved in order to make foreign keys behave in the way you'd expect.

A Dimecres 17 Gener 2007 11:42, ramachandra.bhaskaram@xxxxxxxxx va escriure:
> Hi,
>
> We are having 3 tables;
> 1. persons <-- Base table and no data will be inserted in this table.
> 2. Person1 <-- Inherited table from persons all data will be inserted in
> this table. 3. PersonalInfo  <-- which is storing all personal information
> of the persons and is having the foreign key relationship with the persons
> table.
>
> When we try to insert the data in the personalInfo table it is throwing the
> error stating the primary key does not contain the given value.   But, if I
> try to select from the persons table it is showing the records from its
> inherited tables as well.     Can anybody tell me what might be the problem
> here?   Or else any help regarding the same will be of very much help.
>
> Following is the table structure;
> ---------------------------------------------------------------------
> Create Table persons (
> name varchar,
> age int,
> dob varchar,
> constraint pKey primary key(name)
> );
>  create table person1 ( ) inherits(persons);
>
> Create table personalInfo (
> name varchar,
> contact_id int,
> contact_addr varchar,
> constraint cKey primary key(contact_id),
> constraint fKey foreign key(name) references persons(name)
> );
> ---------------------------------------------------------------------------
>-----------------------
>
> Thanks In Advance,
> Ramachandra B.S.
>
>
>
> The information contained in this electronic message and any attachments to
> this message are intended for the exclusive use of the addressee(s) and may
> contain proprietary, confidential or privileged information. If you are not
> the intended recipient, you should not disseminate, distribute or copy this
> e-mail. Please notify the sender immediately and destroy all copies of this
> message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus
> transmitted by this email.
>
> www.wipro.com

-- 
Albert Cervera Areny
Dept. Informàtica Sedifa, S.L.

Av. Can Bordoll, 149
08202 - Sabadell (Barcelona)
Tel. 93 715 51 11
Fax. 93 715 51 12

====================================================================
........................  AVISO LEGAL  ............................
La   presente  comunicación  y sus anexos tiene como destinatario la
persona a  la  que  va  dirigida, por  lo  que  si  usted lo  recibe
por error  debe  notificarlo  al  remitente  y   eliminarlo   de  su
sistema,  no  pudiendo  utilizarlo,  total  o   parcialmente,   para
ningún  fin.  Su  contenido  puede  tener información confidencial o
protegida legalmente   y   únicamente   expresa  la  opinión     del
remitente.  El   uso   del   correo   electrónico   vía Internet  no
permite   asegurar    ni  la   confidencialidad   de   los  mensajes
ni    su    correcta     recepción.   En    el  caso   de   que   el
destinatario no consintiera la utilización  del correo  electrónico,
deberá ponerlo en nuestro conocimiento inmediatamente.
====================================================================
........................... DISCLAIMER .............................
This message and its  attachments are  intended  exclusively for the
named addressee. If you  receive  this  message  in   error,  please
immediately delete it from  your  system  and notify the sender. You
may  not  use  this message  or  any  part  of it  for any  purpose.
The   message   may  contain  information  that  is  confidential or
protected  by  law,  and  any  opinions  expressed  are those of the
individual    sender.  Internet  e-mail   guarantees   neither   the
confidentiality   nor  the  proper  receipt  of  the  message  sent.
If  the  addressee  of  this  message  does  not  consent to the use
of   internet    e-mail,    please    inform     us    inmmediately.
====================================================================


 


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux