Inheritance and Referencing troubles... (confusing problem)

From: "Christian Marschalek" <cm(at)chello(dot)at>
To: "[GENERAL] PostgreSQL" <pgsql-general(at)postgresql(dot)org>
Subject: Inheritance and Referencing troubles... (confusing problem)
Date: 2001-05-08 22:16:33
Message-ID: 000001c0d80c$8a7b08a0$0200a8c0@server
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey there...

I have something like this:

CREATE TABLE user_table (u_id serial primary key, u_name name);
CREATE TABLE customer_table (c_number int4) INHERTIS (user_table);
CREATE TABLE shadow_table (shadow_username char(15) primary key,
shadow_password char(8), shadow_u_id int4 REFERENCES !and here comes the
question!

When I reference to customer_table (u_id) it does not work... Because
customer table has no in fact no u_id
When I reference to user_table (u_id) it does work... But When I insert
something into the customer table and then try to insert something into
the shadow table -> he can't find the corresponding number in the user
table...

When I insert something directly into the user table i can insert
someting corresponding to it in the shadow table... Funny thing here is
that although u_id is a primary key I can insert keys with the same
value. (there is one than more "1" when I select * from user table and
inserted something into customer table... I don't even need to select
from table* because he seem to follow the inheritance automatically
now...)

I'm horribly confused about this... Hope someone can help!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2001-05-08 22:47:09 RE: rserv
Previous Message Tom Lane 2001-05-08 22:09:20 Re: ALTER COLUMN