Re: Inheritance
От | JanWieck@t-online.de (Jan Wieck) |
---|---|
Тема | Re: Inheritance |
Дата | |
Msg-id | 200007301148.NAA06541@hot.jw.home обсуждение исходный текст |
Ответ на | Re: Inheritance (Ian Turner <vectro@pipeline.com>) |
Ответы |
Re: Inheritance
|
Список | pgsql-general |
Ian Turner wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > `SELECT * FROM Entities*;' > > > > up to and including 7.0.x. > > > > In 7.1, I believe a select on the parent will automatically show the > > children and you will need to do something like `SELECT * FROM ONLY Entities' > > to exclude descendant tables. > > Yes, but what about referential integrity? Can I have a table column > reference a column from Entities*? In my experimentation, this is not the > case. Referential integrity doesn't work with inheritance, and will not in 7.1. It isn't possible to put a unique constraint on a column of Entities* (AFAIK). So that a SELECT pkey FROM Entities will never return any duplicates? The RI implementation of PostgreSQL doesn't insist on such a unique constraint to exist up to now, but it is required by the SQL specs and thus we'll do so someday. pgsql=# create table t1 (pkey integer primary key); NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 't1_pkey' for table 't1' CREATE pgsql=# create table t2 (val integer) inherits (t1); CREATE pgsql=# insert into t1 values (1); INSERT 21274 1 pgsql=# insert into t2 values (1, 11); INSERT 21275 1 pgsql=# select * from t1; pkey ------ 1 1 (2 rows) Am I missing something here? Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #
В списке pgsql-general по дате отправления: