Обсуждение: Inheritance and Update/Delete

Поиск
Список
Период
Сортировка

Inheritance and Update/Delete

От
"Roger Mathis"
Дата:
Hi

I made the following observation:
On the ToDo-List is this entry: "Allow UPDATE/DELETE on inherited table ".
But in my database (7.2.1) it is possible to update/delete rows on inherited
tables, and I even can delete rows from the parent-table. I'm connected with
postgres.
I'm confused...

This is the script of my database:

DROP TABLE Lieferant;
DROP TABLE Kunde;
DROP TABLE Mitarbeiter;
DROP TABLE Person;
DROP TABLE Ort;
DROP SEQUENCE ort_plznr_seq;
DROP SEQUENCE mitarbeiter_mnr_seq;
DROP SEQUENCE kunde_knr_seq;
DROP SEQUENCE lieferant_lnr_seq;

CREATE TABLE Ort (
 PLZNr SERIAL NOT NULL,
 PLZ VARCHAR(8) NOT NULL,
 Ort VARCHAR(32) NOT NULL,
 CONSTRAINT ort_pk PRIMARY KEY (PLZNr));

CREATE TABLE Person (
 PName VARCHAR(64) NOT NULL,
 PVorname VARCHAR(64) NOT NULL,
 PAdresse VARCHAR(64),
 Ort_PLZNr INTEGER NOT NULL,
 PTelefon INTEGER,
 PE_Mail VARCHAR(64),
 CONSTRAINT ort_plznr_fk FOREIGN KEY (Ort_PLZNr)
 REFERENCES Ort(PLZNr));

CREATE TABLE Mitarbeiter (
 MNr SERIAL NOT NULL,
 MEintritt DATE NOT NULL,
 MAustritt DATE,
 CONSTRAINT ma_pk PRIMARY KEY (MNr))
 INHERITS (Person);

CREATE TABLE Kunde (
 KNr SERIAL NOT NULL,
 KZahlungskondition INTEGER NOT NULL,
 CONSTRAINT kunde_pk PRIMARY KEY (KNr))
 INHERITS (Person);

CREATE TABLE Lieferant (
 LNr SERIAL NOT NULL,
 LLieferzeit INTEGER,
 CONSTRAINT lieferant_pk PRIMARY KEY (LNr))
 INHERITS (Person);

INSERT INTO Ort VALUES (1,'6374','Buochs');
INSERT INTO Ort VALUES (2,'6005','Luzern');
INSERT INTO Ort VALUES (3,'8008','Z�rich');
INSERT INTO Ort VALUES (4,'3003','Bern');

INSERT INTO Person VALUES ('Mathis','Roger','Elfenaustrasse
25',2,0413600566,'roger.mathis@gmx.ch');

INSERT INTO Mitarbeiter (PName, PVorname, Ort_PLZNr, MEintritt) VALUES
('Gisler','Roland',2,'2002-07-02');

INSERT INTO Kunde (PName, PVorname, Ort_PLZNr, KZahlungskondition) VALUES
('Fischer','Peter',3,30);

INSERT INTO Lieferant (PName, PVorname, Ort_PLZNr, LLieferzeit) VALUES
('Treyer','Oskar',4,10);


CU Roger



Re: Inheritance and Update/Delete

От
Tom Lane
Дата:
"Roger Mathis" <traderx@gmx.ch> writes:
> I made the following observation:
> On the ToDo-List is this entry: "Allow UPDATE/DELETE on inherited table ".
> But in my database (7.2.1) it is possible to update/delete rows on inherited
> tables, and I even can delete rows from the parent-table.

Hm.  Looks like that item should have been marked "done" a couple
versions ago.  Bruce, is there more to that item than meets the eye?

            regards, tom lane

Re: Inheritance and Update/Delete

От
Bruce Momjian
Дата:
TODO updated.  Thanks.

---------------------------------------------------------------------------

Tom Lane wrote:
> "Roger Mathis" <traderx@gmx.ch> writes:
> > I made the following observation:
> > On the ToDo-List is this entry: "Allow UPDATE/DELETE on inherited table ".
> > But in my database (7.2.1) it is possible to update/delete rows on inherited
> > tables, and I even can delete rows from the parent-table.
>
> Hm.  Looks like that item should have been marked "done" a couple
> versions ago.  Bruce, is there more to that item than meets the eye?
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026