Re: [HACKERS] Inherited constraints and search paths (was Re:

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: [HACKERS] Inherited constraints and search paths (was Re:
Дата
в 12:51:33
Msg-id
25273.1116604306@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Preserving data after updates Berend Tober <btober@seaworthysys.com>
Re: Preserving data after updates Tom Lane <tgl@sss.pgh.pa.us>
Re: Preserving data after updates Berend Tober <btober@seaworthysys.com>
Re: Preserving data after updates Tom Lane <tgl@sss.pgh.pa.us>
Re: Preserving data after updates Berend Tober <btober@seaworthysys.com>
Re: Preserving data after updates Tom Lane <tgl@sss.pgh.pa.us>
Re: Preserving data after updates Berend Tober <btober@computer.org>
Re: Preserving data after updates Tom Lane <tgl@sss.pgh.pa.us>
Re: Preserving data after updates Berend Tober <btober@seaworthysys.com>
Inherited constraints and search paths (was Re: Preserving data after updates) Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Inherited constraints and search paths (was Re: Simon Riggs <simon@2ndquadrant.com>
Re: [HACKERS] Inherited constraints and search paths (was Re: Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Inherited constraints and search paths Simon Riggs <simon@2ndquadrant.com>
Re: [HACKERS] Inherited constraints and search paths (was Re: Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Inherited constraints and search paths (was Berend Tober <btober@seaworthysys.com>
Re: [HACKERS] Inherited constraints and search paths (was Re: Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Inherited constraints and search paths (was Bruce Momjian <pgman@candle.pha.pa.us>
Re: [HACKERS] Inherited constraints and search paths (was Re: Berend Tober <btober@seaworthysys.com>
Simon Riggs  writes:
> Doing anything to restrict dropping of inherited constraints seems like
> wasted effort and potentially annoying anyhow.

Uh, why?  Arguably the constraints are as much part of the parent table
definition as the columns themselves.  If you had "check (f1 > 0)" in
the definition of a table, wouldn't you be pretty surprised to select
from it and find rows with f1 < 0?

regression=# create table parent(f1 int check (f1 > 0));
CREATE TABLE
regression=# create table child() inherits(parent);
CREATE TABLE
regression=# alter table child drop constraint parent_f1_check;
ALTER TABLE
regression=# insert into child values(-1);
INSERT 0 1
regression=# select * from parent;
 f1
----
 -1
(1 row)

I think a good argument can be made that the above behavior is a bug,
and that the ALTER command should have been rejected.  We've gone to
great lengths to make sure you can't ALTER a child table to make it
incompatible with the parent in terms of the column names and types;
shouldn't this be true of check constraints as well?

			regards, tom lane
В списке pgsql-general по дате отправления
От: Kelly Burkhart
Дата:
Сообщение: Finding IP of front end
От: Duane Winner
Дата:
FAQ