Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1icSyz-0001UW-B2 for pgsql-docs@arkaria.postgresql.org; Wed, 04 Dec 2019 11:38:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1icSyv-0006D1-G2 for pgsql-docs@arkaria.postgresql.org; Wed, 04 Dec 2019 11:38:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1icSyu-0006Ct-W7 for pgsql-docs@lists.postgresql.org; Wed, 04 Dec 2019 11:38:09 +0000 Received: from forward104j.mail.yandex.net ([5.45.198.247]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1icSyq-0007eS-9o for pgsql-docs@lists.postgresql.org; Wed, 04 Dec 2019 11:38:07 +0000 Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 060CC4A0D2B; Wed, 4 Dec 2019 14:38:00 +0300 (MSK) Received: from sas2-c635edf95338.qloud-c.yandex.net (sas2-c635edf95338.qloud-c.yandex.net [2a02:6b8:c08:718e:0:640:c635:edf9]) by mxback3g.mail.yandex.net (mxback/Yandex) with ESMTP id vQ9ySm5TfU-bx5CbJJu; Wed, 04 Dec 2019 14:37:59 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1575459479; bh=1y7sVoKfXCH9jwVXI76V9ACEXAXnnQ4JQ6NQQURPeyA=; h=In-Reply-To:Subject:CC:To:From:References:Date:Message-ID; b=gvjWo7J0SJQCeywpc9n5gfC5fFfgg0nBJlnFHCUoQiB2XX0WHPdng2YH8//qBUKnJ 1USw3uWXvHxtWvPyCWfUkQ4yTV+/7fPWdBKS6pSqwX1MK3ejglW4AJoTiFOnvaJuwL VsSp80wORdZs3hgrUPzkf1N0sSrgHVjZZw4fsnlQ= Authentication-Results: mxback3g.mail.yandex.net; dkim=pass header.i=@yandex.ru Received: by sas2-c635edf95338.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 4xkrEjvLyD-bwVOntaT; Wed, 04 Dec 2019 14:37:58 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) Date: Wed, 4 Dec 2019 13:37:57 +0200 From: Eugen Konkov Message-ID: <471116573.20191204133757@yandex.ru> To: Bruce Momjian CC: PostgreSQL-development , pgsql-docs@lists.postgresql.org Subject: Re: Does 'instead of delete' trigger support modification of OLD In-Reply-To: <20191107222818.GA18712@momjian.us> References: <919823407.20191029175436@yandex.ru> <20191106185935.GE1843@momjian.us> <1771593631.20191107112032@yandex.ru> <352093181.20191107112429@yandex.ru> <20191107212655.GA487@momjian.us> <20191107222818.GA18712@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi again. > Thinking some more on this, I now don't think a TODO makes sense, so I > have removed it. Please look into this example: https://dbfiddle.uk/?rdbms=postgres_12&fiddle=95ed9fab6870d7c4b6266ea4d93def13 This is real life code from our production. You can see that this is important to get correct info about deleted data -- EXPECTED app_period: ["2018-08-20", "2018-08-25") -- ACTUAL app_period: ["2018-08-14", ) > Triggers are designed to check and modify input data, and since DELETE > has no input data, it makes no sense. Please put back into TODO list this feature request to allow triggers to modify output data. INPUT -- receives data OK (behavior is expected) UPDATE -- receives and returns data OK (behavior is expected) DELETE -- returns data FAIL (behavior is not expected) This is inconsistent to allow modify output data for UPDATE and restrict to do this for DELETE Thank you -- Best regards, Eugen Konkov