I am trying to write a rule that on insert if there is conflict to do nothing. The hard part is that I am using java code for interacting with the db and the save method expects an instance to be returned. So the goal I am trying to achieve is, a rule that triggers on conflict when inserting, does nothing and returns the given instance. I have tried to do something like that :
CREATE RULE "my_rule" AS ON INSERT TO "table_x"
WHERE EXISTS(SELECT 1 FROM table_x WHERE id = NEW.id)
DO INSTEAD
Select * from table_x WHERE(id=NEW.id);