inheritance
От | Volker Krey |
---|---|
Тема | inheritance |
Дата | |
Msg-id | 3F098D3D.3050106@fz-juelich.de обсуждение исходный текст |
Ответы |
Re: inheritance
|
Список | pgsql-novice |
Hello, I am working with PostgreSQL 7.2.1 under Windows 2000 (native version by PeerDirect) and have a problem with inheritance. To illustrate it, I will take the inheritance example from the Users Guide with a minor change, i.e. I introduce a PRIMARY KEY to the original table cities. CREATE TABLE cities ( name text PRIMARY KEY, population float, altitude int -- (in ft) ); CREATE TABLE capitals ( state char(2) ) INHERITS (cities); My problem now is the following: If I insert a data set into capitals, everything looks fine and a SELECT on cities returns the appropriate data just inserted into capitals. But if I now insert a city with the same name into cities the system will accept it so that I find myself with two entries in cities that have the same PRIMARY KEY. Of course this causes trouble, e.g. if I want to UPDATE one entry, an error message appears. If I still insist on changing the entry, both will be affected, because they share the same PRIMARY KEY. Can anybody tell me how to solve this problem? Maybe it has already been solved and is just a result of me using the old 7.2.1 version. I'd be very grateful for any hints, since the inheritance features of PostgreSQL would make life a lot easier for me. Thanks for your help, Volker. -- Volker Krey v.krey@fz-juelich.de
В списке pgsql-novice по дате отправления: