Connecting Tech Pros Worldwide Forums | Help | Site Map

How can we manage PK and FK using inheritance??

Newbie
 
Join Date: Oct 2006
Posts: 1
#1: Oct 22 '06
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

Reply


Similar PostgreSQL Database bytes