Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 24AA663280D for ; Fri, 13 Aug 2010 18:45:15 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 30003-03 for ; Fri, 13 Aug 2010 21:45:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 975F7632731 for ; Fri, 13 Aug 2010 18:45:07 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o7DLj5Aa022560; Fri, 13 Aug 2010 17:45:05 -0400 (EDT) To: Ricardo Bayley cc: pgsql-admin@postgresql.org Subject: Re: NEW + tableOID In-reply-to: References: Comments: In-reply-to Ricardo Bayley message dated "Fri, 13 Aug 2010 18:08:15 -0300" Date: Fri, 13 Aug 2010 17:45:05 -0400 Message-ID: <22559.1281735905@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/110 X-Sequence-Number: 35359 Ricardo Bayley writes: > I do this with triggers. This issue I have is that the tableoid data cannot > be used with the NEW keyword. I always get value 0 instead of the actual > tableoid. That might work in an AFTER trigger, but it definitely won't work in a BEFORE trigger, because the NEW row isn't actually part of the table at that point. You'd probably be better off to rely on the trigger function TG_RELID parameter instead, anyway. regards, tom lane