PDA

View Full Version : Inheritance


zdeh98
03-21-02, 23:55
Can inheritance be a substitute to creating views in postgresql? ...
I am quite confused with how inheritance works.

Thanks for the help!
:)

uhexo
03-22-02, 20:40
No, You can't. Views and inheritance tables are differnt things.

The view is subset of data extract from one or more tables. And the otherwise, the inherintace table is "table" which is extension of the other one.

By example.

if I had defined the table as:
table person ( name, address, city )
I could made a subset of the table that show me person of particullar city:
create view person_from_queryland
as
select * from person
where city = "queryland" ;

otherwise, I can made a extention table as:

create table employee
( cardid )
inheritence person ;

that is Table employee which includes fields of person and cardid field.


:D I omitted datatypes of tables for simplity.

A. Médici
04-09-02, 12:51
Postgres developers took long time to admit that them inheritance wasn't working and also wasn't SQL99 !!! :confused:

A lot's of bug are relatives of the inheritance programming way.

in the new version 7.2.1 should fix those bugs (apparently for the inheritance it"s sure; but I havaen't test it for the REFERENCES)


what a pity !!!
A soo beautiful database in Open Source but little bug!

Hope next version will be OK :)