Inheritance and Referencing troubles... (confusing problem) - Mailing list pgsql-general

From Christian Marschalek
Subject Inheritance and Referencing troubles... (confusing problem)
Date
Msg-id 000001c0d80c$8a7b08a0$0200a8c0@server
Whole thread Raw
Responses Re: Inheritance and Referencing troubles... (confusing problem)
List 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!


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: ALTER COLUMN
Next
From: Alvaro Herrera
Date:
Subject: RE: rserv