Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f9EXk-0002Jl-0y for pgsql-general@arkaria.postgresql.org; Thu, 19 Apr 2018 18:44:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f9EXi-0001hq-IM for pgsql-general@arkaria.postgresql.org; Thu, 19 Apr 2018 18:44:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f9ETy-0003Y7-UE for pgsql-general@lists.postgresql.org; Thu, 19 Apr 2018 18:40:35 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f9ETu-0008CS-1T for pgsql-general@postgresql.org; Thu, 19 Apr 2018 18:40:33 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 955A7215AC; Thu, 19 Apr 2018 14:40:26 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 19 Apr 2018 14:40:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=p1O9pCSbZC3t8XnhhPmsKnzofBrqR 7HP9YGRScoXhCA=; b=iHD02r6UJMwXtK881dtbCNVJy/kqhSHzUWu+VTJbi8YxZ iPMtc4GNQyUoYSc0H0bEPnGLCKuX+1W3xU1C/G3BL5I3GQ6DRFZ8/tJAw8+L695C eGolJTQkeIZro24q0HHpWWHwDxclGNYrFgsw5WmJRMk95lRZWzaCNDzDgCr5UtxK uOvsBv5iH/Fh5Hq6tvreh0EqCpnqpaY7a6UN+Z6xY8g7ywoD+tSFT8xXyuJK8M4W fffJBaLdi8CbU9/7gwdoi5y3+ELrqcS2aAnsn0CgdBuAqyNh4HpnhfofN+tVjhN4 H5JSIl5NaQafMsZ7b1jg7Fxga16AnotgStQntdXMw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=p1O9pC SbZC3t8XnhhPmsKnzofBrqR7HP9YGRScoXhCA=; b=Uy2B6YCtLAsRfg1Po3Deme Mp1vkmU3vSXYMmmL4Bx1G06K7g6ZGRgGZPuFGy79BUK4RjaUpIzyx5htl90U8H8V NDNDcZ2iPr28OOaiP8/vGwgncFiL9pEsj18FPgt5bRZVU09V97ZEhrujNeLStY14 fN2to4Tdb810fjZ3LX6aUcO32pszwnhLVNAxcuR4mGV4CFHrEr1Ue8+HrLL3UYAf /Z8ACNn1x3vSbSezobA4fbsVNYaYOEHDhSbs9B/ZE5O4AgM+dr2WdWF8PUVIqrv6 PDDf2hLevhximZRSbBvTpLs4GF99vj8JbPGgbPayL6lrPRjUnY4DAeVtUs/PWxmA == X-ME-Sender: Received: from ranger.suse (c-73-239-117-238.hsd1.wa.comcast.net [73.239.117.238]) by mail.messagingengine.com (Postfix) with ESMTPA id 0ADD4E5092; Thu, 19 Apr 2018 14:40:25 -0400 (EDT) Subject: Re: Problem with trigger makes Detail record be invalid To: PegoraroF10 , pgsql-general@postgresql.org References: <1524160534707-0.post@n3.nabble.com> <7cb5806e-7371-5c19-1c7b-b8ac556bdfb5@aklaver.com> <1524162628880-0.post@n3.nabble.com> From: Adrian Klaver Message-ID: <5cae1bca-4536-bc12-e74f-12a2fff95452@aklaver.com> Date: Thu, 19 Apr 2018 11:40:25 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1524162628880-0.post@n3.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 04/19/2018 11:30 AM, PegoraroF10 wrote: > I know my trigger is incorrect. I know that I can use TG_OP to know what > operation is being done. > My question is ... >> Is this a bug or it´s mine responsability to check that trigger result ? > > I think it´s a bug because if something got wrong on detail deletion and it > was rolled back, how could be a parent record be deleted ? In your example I saw no rollback or error message: "delete from Master where ID=2; select * from Master; --will show no records. select * from Detail; --will show one record pointing to Master_ID=2, that doesn´t exist anymore." Was there an error message? Then there is the fact that your trigger is doing something to the row BEFORE the delete or update and presumably modifying it. Without knowing what the function is doing or what it is actually returning then we are in full on guessing mode. > > > > -- > Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html > -- Adrian Klaver adrian.klaver@aklaver.com