Re: Multiple RULES on Views

From: Sebastian Böck <sebastianboeck(at)freenet(dot)de>
To: David Wheeler <david(at)kineticode(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Multiple RULES on Views
Date: 2005-04-22 09:09:48
Message-ID: 4268BF5C.6010207@freenet.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hannes Dorbath 2005-04-22 09:15:27 artificial keys or not?
Previous Message Typing80wpm 2005-04-22 08:07:04 Postgresql Windows ODBC