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
---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your message can get through to the mailing list cleanly