By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,041 Members | 1,734 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,041 IT Pros & Developers. It's quick & easy.

How can we manage PK and FK using inheritance??

P: 1
Hello friends;
I need to give somebody the permission to access somewhere in the system.
That permission can be through the group or user, but I has found problems
with using of inherits. What is the good solution to this situation? It would be
better to remove all FK and PK, and use other ways? how can I do it?

CREATE TABLE identify(
id_identify SERIAL PRIMARY KEY NOT NULL,
name TEXT NOT NULL
);

CREATE TABLE team(
constraint "pk1" primary key ("id_identify")
)
INHERITS(identify);


CREATE TABLE userdb(
constraint "pk2" primary key ("id_identify"),
nick_name TEXT NOT NULL,
passwd TEXT NOT NULL
)
INHERITS(identify);

CREATE TABLE permission(
id_identidade INTEGER NOT NULL REFERENCES identify(id_identify),
permited_local text
);

insert into userdb (name,nick_name,passwd) values ('john','brasilian','123');
insert into permission values(1,'admin_page.html') -- Occur an error!!!!

Thanks
Oct 22 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.