Re: Re: Changing the default value of an inherited column

Поиск
Список
Период
Сортировка
От ncm@zembu.com (Nathan Myers)
Тема Re: Re: Changing the default value of an inherited column
Дата
Msg-id 20010329124647.E3797@store.zembu.com
обсуждение исходный текст
Ответ на Re: Re: Changing the default value of an inherited column  ("Oliver Elphick" <olly@lfix.co.uk>)
Ответы Re: Re: Changing the default value of an inherited column  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Thu, Mar 29, 2001 at 02:29:38PM +0100, Oliver Elphick wrote:
> Peter Eisentraut wrote:
>   >Tom Lane writes:
>   >
>   >> It seems that in pre-7.0 Postgres, this works:
>   >>
>   >> create table one(id int default 1, descr text);
>   >> create table two(id int default 2, tag text) inherits (one);
>   >>
>   >> with the net effect that table "two" has just one "id" column with
>   >> default value 2.
>   >
>   >Although the liberty to do anything you want seems appealing at first, I
>   >would think that allowing this is not correct from an OO point of view.
> 
> I don't agree; this is equivalent to redefinition of a feature (=method) in
> a descendant class, which is perfectly acceptable so long as the feature's
> signature (equivalent to column type) remains unchanged.

The O-O principle involved here is Liskov Substitution: if the derived
table is used in the context of code that thinks it's looking at the
base table, does anything break?

Changing the default value of a column should not break anything, 
because the different default value could as well have been entered 
in the column manually.

Nathan Myers
ncm@zembu.com


В списке pgsql-hackers по дате отправления:

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: RC2 schedualed for Tomorrow evening ...
Следующее
От: "Oliver Elphick"
Дата:
Сообщение: Re: INSERT/SELECT with ORDER BY and LIMIT in 7.1?