Thread: rules ON INSERT

rules ON INSERT

From
Ralph Heinkel
Date:
Hi,

thanks to everybody who has answered to my question. Indeed the documents
let the programmer hope that s/he gets what should be expected:

In postgresql-7.4.1/doc/html/rules-update.html it says:
    For ON INSERT rules, the original query (if not suppressed by INSTEAD)
    is done before any actions added by rules. This allows the actions to
    see the inserted row(s).

The relevant part is "to see the inserted row(s)". This is really misleading
if in reality something else (like a macro as I've learned now) is executed.

My naive question is: Would it really be a lot of work in the postgres
code to actually return the results instead of executing the macro?
Then the postgres world would be simpler again and everybody could
just use rules without having so separate two cases:
1. Rules ON INSERT work without 'serials'
2. Rules ON INSERT don't work with 'serials', use triggers instead.

Thanks,

Ralph