Re: Multiple RULES on Views

Поиск
Список
Период
Сортировка
От Sebastian Böck
Тема Re: Multiple RULES on Views
Дата
Msg-id 4268BF5C.6010207@freenet.de
обсуждение исходный текст
Ответ на Multiple RULES on Views  (David Wheeler <david@kineticode.com>)
Ответы Re: Multiple RULES on Views
Список pgsql-general
David Wheeler wrote:

[...]
> Well, I didn't have an unconditional update rule, so I added one without
> removing the other two:
>
> CREATE RULE nothing_one AS
> ON INSERT TO one DO INSTEAD NOTHING;
>
> And it worked! Now I can have an insert do an INSERT or UPDATE on
> another table magically.
>
> But my question is this: Is this a known and supported behavior? If not,
> is it likely to change? If so, how is the order or rules evaluated when
> a query is sent to the database? Order of definition? Alphabetically?

Yes, this is the correct way to do updateable views.

Multiple rules on the same table and same event type are
applied in alphabetical name order.

See:
http://www.postgresql.org/docs/current/static/sql-createrule.html
for more details and the above quote.

HTH

Sebastian

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

Предыдущее
От: Patrick.FICHE@AQSACOM.COM
Дата:
Сообщение: Re: Use of temporary tables in functions
Следующее
От: Hannes Dorbath
Дата:
Сообщение: artificial keys or not?