Matthew Schumacher <matt.s@aptalaska.net> writes:
> update test set id = 1, data = 'test';
The above is a pretty bad idea in any case --- think about what happens
when you have some data in the table. It'll set *every row* to id = 1
and data = 'test'. The reason nothing happens when there is nothing in
the table is that there is no row that can be updated. Taking an action
"instead of" an action that doesn't happen still doesn't happen.
Any practical application using UPDATE is going to say UPDATE ... WHERE
to limit the set of rows that get changed, and what you have to think
about is whether you need a rule to do anything in that situation.
For what I think you want this application to do, it'd make more sense
for the application to say "INSERT some-data", and for you to have a
rule that changes that into an UPDATE if there is a pre-existing row
with matching key columns.
regards, tom lane