Re: Column defaults fail with rules on view

Поиск
Список
Период
Сортировка
От
Тема Re: Column defaults fail with rules on view
Дата
Msg-id 65122.216.238.112.88.1063986690.squirrel@$HOSTNAME
обсуждение исходный текст
Ответ на Re: Column defaults fail with rules on view  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
> Richard Huxton <dev@archonet.com> writes:
>> On Friday 19 September 2003 09:00, btober@seaworthysys.com wrote:
>>> Is this supposed to work that way? I would expect field3 and field4
>>> to have their respective column defaults assigned on the second
>>> INSERT (row B), just like on the first INSERT (row A).
>
>> Hmm - well, you're explicitly telling it to insert VALUES (...,
>> new.field3,  ...) so if new.field3 is null then it *should* do that.
>
> Exactly.  The defaults attached to the underlying table determine what
> gets added to an INSERT into the underlying table.  In this case, since
> the rule's INSERT specifies all the fields, there is no scope for those
> defaults to apply.
>
> What Berend actually wants is to attach column defaults to the *view*,
> so that they apply to an INSERT mentioning the view.  You can do this
> in recent PG releases (7.3 for sure, not sure about 7.2) using ALTER
> TABLE ... ADD DEFAULT.

Now THAT's WAY cool! I can do ALTER TABLE ...ADD DEFAULT against views?

Sounds like exactly the ticket. Just tried it. It works.

That is SO sweet...the more I learn about pg the more excited I get.

~Berend Tober




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Trouble with some concepts
Следующее
От: dschmidt@lexmark.com
Дата:
Сообщение: