X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EAAAAD1B44E for ; Tue, 30 Dec 2003 22:03:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 71187-08 for ; Tue, 30 Dec 2003 18:03:10 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 21B67D1B480 for ; Tue, 30 Dec 2003 18:03:08 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id hBUM37U6019602 for ; Tue, 30 Dec 2003 22:03:07 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id hBULn5fj009925 for pgsql-sql@postgresql.org; Tue, 30 Dec 2003 21:49:05 GMT From: treat00@yahoo.com (Thomas Reat) X-Newsgroups: comp.databases.postgresql.sql, comp.databases.postgresql.questions Subject: "on insert" rules happen before the insert? Date: 30 Dec 2003 13:49:06 -0800 Organization: http://groups.google.com Lines: 14 Message-ID: <3c4289ad.0312301349.2e9ac46f@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/19 X-Sequence-Number: 16412 The postgresql documentation claims that "on insert" rules are executed after the insert. This is not happening for me. I have a rule that is being executed even though the insert should have failed due to a foreign key check. The rule does an insert that is failing, and the whole insert fails. So in this case it's not a huge problem. But I get a completely useless error message, and as far as I can tell there is no way to determine exactly what caused the failure (except for the fact that I happen to know what rule can cause that error). I'd like the person inserting a row that violates the foreign key check to get a useful error message. Is this a documentation bug? How can I get the desired behavior?