Обсуждение: BUG #2355: Problem with INHERITS

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

BUG #2355: Problem with INHERITS

От
"Jaime Lara Alvarez"
Дата:
The following bug has been logged online:

Bug reference:      2355
Logged by:          Jaime Lara Alvarez
Email address:      jimmy_tec@yahoo.com.mx
PostgreSQL version: 8.1.3
Operating system:   Windows
Description:        Problem with INHERITS
Details:

// ----------- 1 --------------------------- //

CREATE TABLE cities (
  id varchar(5) PRIMARY KEY,
  name       text
);

CREATE TABLE capitals (
  state      text
) INHERITS (cities);

//------------ 2 ------------------------------//
insert into cities values ('C-001','Houston');
insert into cities values ('C-002','San Antonio');

insert into capitals values ('C-003','Dallas','TX');

// ------------3 --------------------------------//
insert into cities values ('C-004','Washington')

insert into capitals values ('C-004','Washington','W')

//------------ 4 ---------------------------------//

select * from cities

Data Output
Row   id(varchar)       name(text)
 1     "C-001"          "Houston"
 2     "C-002"          "San Antonio"
 3     "C-004"          "Washington"    <------
 4     "C-003"          "Dallas"
 5     "C-004"          "Washington"    <------

That's a problem with the primary key

Re: BUG #2355: Problem with INHERITS

От
Tom Lane
Дата:
"Jaime Lara Alvarez" <jimmy_tec@yahoo.com.mx> writes:
> That's a problem with the primary key

Please note the caveats at the bottom of
http://www.postgresql.org/docs/8.1/static/ddl-inherit.html

            regards, tom lane