X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A50E2529B9 for ; Sun, 14 Aug 2005 10:14:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39014-10 for ; Sun, 14 Aug 2005 13:14:49 +0000 (GMT) Received: from postfix4-2.free.fr (postfix4-2.free.fr [213.228.0.176]) by svr1.postgresql.org (Postfix) with ESMTP id 239DF52936 for ; Sun, 14 Aug 2005 10:14:48 -0300 (ADT) Received: from [192.168.0.103] (mna75-7-82-230-82-150.fbx.proxad.net [82.230.82.150]) by postfix4-2.free.fr (Postfix) with ESMTP id 46D75323313 for ; Sun, 14 Aug 2005 15:14:52 +0200 (CEST) Message-ID: <42FF436B.8030701@free.fr> Date: Sun, 14 Aug 2005 15:13:15 +0200 From: santiago Reply-To: chetzacoalt@free.fr User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: catch an 'update where false' ? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200508/79 X-Sequence-Number: 22307 Hi thanks all for your answers ! to Lane Van Ingen: my purpose is to write a trigger on update so that 'users' might then us update without having to perform the if found. I don't know if I was clear about that idea, but the checks on where update will or not succeed, is what I'm trying to hide from the upper-level users for this specific table. If what your sugesting works inside such a trigger, please show my some code of how to do that, beacause it's precisely what I fail to do. to Alvaro Herrera : according to my book, triggers are only implemented whit the FOR EACH ROW clause in postgres, and not available in the FOR EACH STATEMENT case. has this changed in some new version ? which shall I use then ? thanks to both ! Alvaro Herrera wrote: > On Fri, Aug 12, 2005 at 05:13:24PM +0200, santiago wrote: > > Triggers FOR EACH ROW are called once for each updated row. I think you > could try with a "FOR EACH STATEMENT" trigger. > Lane Van Ingen wrote: > Don't know where you are doing this, but I can think of a couple ways: > (1) Do a 'select count(*) ....' on what you are trying to > update first to see if it returns a count greater than 0 > (2) If in pl/pgsql functions, you can use the 'IF FOUND' or 'IF NOT FOUND' > construct to see if update was successful > > NOTE: I saw that in version 8.1 you will be able to test a PostgreSQL- > supplied variable, but it is not available until 8.1 release. >